Get the executable's directory

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mudley
:warning: Old Version Published before Godot 3 was released.

Is there a way to get the directory that the game’s .exe file is?

:bust_in_silhouette: Reply From: eons

Something like Globals.globalize_path("res://") should do the trick.

http://docs.godotengine.org/en/stable/classes/class_globals.html#class-globals-globalize-path

:bust_in_silhouette: Reply From: earlroxas

In Godot 3.2 you can use OS.get_executable_path() to get the path of exe file (including the exe filename and extension). If you want to get only the directory use OS.get_executable_path().get_base_dir()
source