Hello
Is it possible to get the directory containing the current executable (the compiled application)?
I know os.get_current_directory()
returns the current working directory path but this is not guaranteed to be the directory that contains the executing file
Thanks
You should be able to join os.get_current_directory()
with os.args[0]
.
Perfect, that works. Thank you
Glad to help 
Btw, I didn’t jump to this conclusion immediately, but googled how to do it in C. Often, solutions from C also apply in Odin so I do that a lot.
1 Like
Oh, and maybe check if os.path[0] is an absolute path as well. In that case, you don’t need the current dir at all.
1 Like
There are edge cases where that does not work, the WIP replacement of core:os
, core:os/os2
has os2.get_executable_path
and os2.get_executable_directory
for this purpose.
1 Like