Godot: ProjectSettings.globalize_path() is not working on exported game.

Created on 4 Mar 2020  路  4Comments  路  Source: godotengine/godot

Godot version:
Godot 3.2.stable

OS/device including version:
Windows 10

Issue description:
I want to get the executable path of my exported game. According to this i can use Globals.globalize_path() to do that. So, in Godot 3.2 the method moved to ProjectSettings.globalize_path() (?,CMIIW). It works well when I play the game from editor. But when I export it the method is not working.

Steps to reproduce:
Use my test project below.
Play it directly in editor, it works!
Export, execute, it doesnt work!

Minimal reproduction project:
GlobalizePathBug.zip

bug confirmed core

Most helpful comment

I think we need to investigate why this doesn't work, it is kind of important that parsing a path with user:// or res:// in it actually results in returning the full path on disk, including on exports.

Simply adding the executable path in front won't work consistently and is not a fix.

@akien-mga any idea who should know how this is intended to work and why it may fail on exports?

All 4 comments

To get the executable path use OS.get_executable_path() with exported games. Projectsettings.globalize_path() works while in the editor but it may not give you the correct path depending on the system and how it's configured when exported.

Oh thank you. I didn't know that method exist. So the Projectsettings.globalize_path(), is not suppose to work on exported game?

I guess docs should mention it if it's intended.

I think we need to investigate why this doesn't work, it is kind of important that parsing a path with user:// or res:// in it actually results in returning the full path on disk, including on exports.

Simply adding the executable path in front won't work consistently and is not a fix.

@akien-mga any idea who should know how this is intended to work and why it may fail on exports?

Was this page helpful?
0 / 5 - 0 ratings