Is there a way to find the executable path?

Support for the GBA/DS/Gamecube/Wii media card library
Post Reply
Lino
Posts: 16
Joined: Thu Jan 28, 2010 7:53 am

Is there a way to find the executable path?

Post by Lino » Sat Apr 10, 2010 4:38 pm

hello everybody,

Im working on my fb4nds, some people put the executable in a folder called fb4nds, but when my hb opens the file in data folder it doesnt find anything. Is there a way to find the dir where the executable is stored?

Thanks for your answers.

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: Is there a way to find the executable path?

Post by vuurrobin » Sat Apr 10, 2010 5:54 pm

you can check to see if argv[0] has been given to main, which should hold the path and name of the executable. like this:

Code: Select all

int main(int argc, char* argv)
{
	if(argc >= 1)
	{
		iprintf("executable path and name is %s.\n", argv[0]);
	}
	else
	{
		iprintf("executable path and name hasn't been given.\n");
	}

	return 0;
}
although this isn't tested.

and note that some cards firmware doesn't support argv.

other than that, there isn't really a good way to get the path+name.

Lino
Posts: 16
Joined: Thu Jan 28, 2010 7:53 am

Re: Is there a way to find the executable path?

Post by Lino » Sat Apr 10, 2010 6:09 pm

It doenst work :(

StevenH
Posts: 133
Joined: Sun Feb 22, 2009 7:59 pm

Re: Is there a way to find the executable path?

Post by StevenH » Sun Apr 11, 2010 10:25 am

Lino wrote:It doenst work :(
The above code will only work on hbmenu or card firmware's that support the new ARGV protocols.

Basically download the hbmenu from the SVN, and install it onto your card, run that as your firmware, or from your firmware prior to opening your app.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests