Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Kyle Guarco |
I’d like to use a GDScript as a configuration file at runtime. I know I can use load("path")
, but could I maybe read the configuration file from the executable’s current directory?
If I recall, the configuration files for a game are created and modified under user://
, which, in turn, is found in a directory under the user owned directory. For example, under Linux, it’s usually $HOME/.local/share/godot/app_userdata/<game name>
. So if you’re going to use configuration files, it’ll probably have to be from the user://
directory.
Ertain | 2019-05-02 19:20
So there’s no direct way to find the executable’s current path?
Kyle Guarco | 2019-05-03 00:59
AFAIK, you can’t get the path to the location of the executable from within the game.
Ertain | 2019-05-03 05:40
After digging a bit more into the documentation, maybe there’s a way to do this.
The documentation on the functionality between the OS and the engine has something about this topic. The get_executable_path()
function maybe able to get the current directory.
Ertain | 2019-05-03 20:45
This ended up working very well for me, thank you!
Kyle Guarco | 2019-05-06 01:40