Hi, I was reading the documentation for the method OS.get_executable_path() because I’m writing this function:
static func _directory_exist_on_executable_path(directory_path: String) -> Error:
#if OS.get_name() == "macOS":
#OS.create_instance()
var real_path = OS.get_executable_path().get_base_dir().path_join(directory_path)
var directory = DirAccess.open(real_path)
if directory == null:
return DirAccess.get_open_error()
return OK
So my question it’s not about it not working since it does what I do but I have seen the next warning in documentation and I don’t quite understand it, how should I do it in macOS ?
● String get_executable_path() const
Returns the path to the current engine executable.
Note: On macOS, always use create_instance() instead of relying on executable path.
I’ve not tested this but I thin that’s because on macOS the exported .app file is just a folder structure that the OS treats differently so OS.get_executable_path() may return you something like .../my_game.app/Contents/MacOS or something like that which may cause some issues if you try to launch the executable that’s inside that folder.
You are absolutely right, create an instance just to check a directory path makes no sense at all.
I’ll leave it here for now since it doesn’t block me in anything although I still have the mystery of create_instance and how to apply it exactly for mac.