Getting Executable Directory

N

NoFontNL

Guest
Is there a way to get the location of the executable. Let's say I export my game to C:\Users\Nofontnl\Desktop\Game\
and when I run the game, how would I get above location? working_directory and program_directory don't return this path. Is there an extension? I've searched and downloaded some extensions, but there is no documentation, or I can't find the right function in the extension.

Help would be appreciated. Thanks in advance.
 
N

NoFontNL

Guest
yes, I'm testing it when I compiled my game. Any suggestions?
 
I think its a bug, there was another thread about this recently. program_directory when used for writing files seems to incorrectly return the %localappdata% folder

What folder is program_directory giving you?
 
N

NoFontNL

Guest
this is what I get from show_message(program_directory)
(Compiled game)
upload_2019-11-10_14-11-45.png
 

rIKmAN

Member
What are you trying to do, copy files using that path?
There are currently some issues with that which can be seen in this thread, but if you output program_directory to the console or the screen then it should report the correct directory that the compiled in being run is in - at least it does for me (it just doesn't work when copying files to it.)

What version of GMS are you using?
 
N

NoFontNL

Guest
Is there a way to get the path with an extension? I'm trying to download files to the executable location.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I see no need to use an extension here when you're already using the correct function, but, at least from what I can tell, the wrong export. Until you've verified whether changing that will resolve this, there's no merit to offering further advice.
 
N

NoFontNL

Guest
I am using the single executable export because of convenience. Changing the export type resolves this, but I wanted to know if there is a workaround, take for example an extension.
 
S

Sam (Deleted User)

Guest
Although if you are using the single exe export, it sounds like you are using GMS 1.4. My extension can't get the single exe's program path, because that is actually a parent process of the actual game being executed. If you export your game as a zip or installer, this extension should work for you: https://marketplace.yoyogames.com/assets/5510/file-manager
 
Top