gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Retrieving Dir of Executable

#140535 - gamix - Mon Sep 17, 2007 7:48 am

Simple questions. How can I retrieve the path of the current executable from libfat? Essentially I would like my program to save files in the current folder instead of the root, but I haven't found a way without changing directory to a named directory with "chdir". I also tried querying argv[ 0 ], but with no luck.

I observed the behavior of many homebrew applications and they all seem to dump files on the root folder unless I specify a path explicitly ( e.g. ScummVM DS ). I actually wonder if it is possible to do something like that, conssidering that this information should come from the device itself ( MK5-GIGA in my case ).

#140536 - Sektor - Mon Sep 17, 2007 8:19 am

It's not possible at the moment. The majority of launchers don't save the current path in any standard location (most don't save it at all). Hopefully there will be some standard in the next devkit but it will require the launcher and .nds to support it (Chishm and Wintermute were working on it).

You can search the file system for your .nds file, Lick released some code that does this and I think someone else made something like that.

Saving data in root/data/appname/ seems to be common but not everyone does it. Sticking an ini file in root with the path to the data folder is also used by a few apps.
_________________
GTAMP.com/DS

#140608 - HyperHacker - Tue Sep 18, 2007 6:49 am

Sektor wrote:
Saving data in root/data/appname/ seems to be common but not everyone does it. Sticking an ini file in root with the path to the data folder is also used by a few apps.
The former is much less annoying, since it avoids having a ton of files in the root.
_________________
I'm a PSP hacker now, but I still <3 DS.

#140667 - Jesse - Wed Sep 19, 2007 12:02 am

You can also use EFS lib and grab the exe-path from that, since that scans the memorycard during initialization (and it's a great library).

http://forum.gbadev.org/viewtopic.php?t=13195

#141235 - gamix - Sun Sep 23, 2007 11:43 am

Thanks a ton! I like this EFS lib you mentioned!