Page 1 of 1
Is there a way to find the executable path?
Posted: Sat Apr 10, 2010 4:38 pm
by Lino
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.
Re: Is there a way to find the executable path?
Posted: Sat Apr 10, 2010 5:54 pm
by vuurrobin
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.
Re: Is there a way to find the executable path?
Posted: Sat Apr 10, 2010 6:09 pm
by Lino
It doenst work
Re: Is there a way to find the executable path?
Posted: Sun Apr 11, 2010 10:25 am
by StevenH
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.