BUG: Mixed folder slashes from config.gamedir

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
User avatar
Posts: 287
Joined: Sun Nov 06, 2016 5:34 pm

BUG: Mixed folder slashes from config.gamedir

#1 Post by ISAWHIM » Thu Jan 30, 2020 11:24 am

EDIT: Unsure if it is 100% relevant, but the "Path" is set by the PREFERENCES settings, for the PROJECTS DIRECTORY. (Here, obviously it is set to "E:\RenPyProjects", on a "Windows computer".) I am unsure if the issue exists if this path is not explicitly set by the user. Thus, using the default built-in hard-coded location. Which I assume uses all forward-slashes.

PROBLEM: config.gamedir outputs a "path" that is invalid in windows.

EXAMPLE OUTPUT: "E:\RenPyProjects\MyGame/game" (Last slash is renpy/linux/html style. Rest are windows folder slashes.)

EXPECTED OUTPUT 1: "E:\RenPyProjects\MyGame\game" (For windows, with os.path commands)

EXPECTED OUTPUT 2: "E:/RenPyProjects/MyGame/game" (For renpy/linux/html use)

Fix for "OUTPUT 1" (Use with windows and python os.path commands)
SOLUTION 1: config.gamedir.replace("/","\\")

Fix for "OUTPUT 2" (Use within renpy/html/linux commands)
SOLUTION 2: config.gamedir.replace("\\","/")

More correct output, would be to use the OS slashes, for the entire output, or just use RenPy's expected internal folder structure slashes. For the final output. If RenPy changes them internally, for itself, then the best option would be to use the correct OS slashes, so this return value can be used with all the os.path commands in python. (In the current state, it will not work in windows and shouldn't be working in RenPy, as the slashes are not escaped and mixed. But I assume RenPy is making them RenPy safe, as a precaution, internally. Or, it isn't using this value directly at all.)

Post Reply

Who is online

Users browsing this forum: No registered users