[A5] Getting directory exe is running in
Neil Roy

I just wanted to store the path that the executable is running in. When I try and check for a file, it shows it as not being there even though it is in the same folder as the executable, so I am uncertain where it is looking.

When I used some code I found in some of the other posts in these forums, all I got was "\" which is definitely wrong. Now, I can look at argv[0] and that gives me the full path, but it includes the exe filename, also, I doubt this is very cross platform friendly (although I am mainly working with Windows at the moment).

Is there an Allegro 5 function to provide this, or should I parse argv[0] myself?

Thanks.

Thomas Fjellstrom

take a look at al_get_standard_path.

Arthur Kalliokoski
  ALLEGRO_PATH *path;
  path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
  al_change_directory(al_path_cstr(path,ALLEGRO_NATIVE_PATH_SEP));

jmasterx

Closest I see is https://www.allegro.cc/manual/5/al_get_current_directory

nvm, above is better.

Neil Roy

ALLEGRO_PATH *path;
path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
al_change_directory(al_path_cstr(path,ALLEGRO_NATIVE_PATH_SEP));

Thanks.

That worked.

Edit: I'll create a new thread for my next problem.

Thread #613219. Printed from Allegro.cc