Richter64 / usbloader-gui

Automatically exported from code.google.com/p/usbloader-gui
0 stars 0 forks source link

Read config file from application dir #170

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Load the initial config.txt from same folder as the boot.dol
This is mandatory, if you have more loaders in different dirs with
different settings.

store the app root eg in the CFG var for later reuse.
call the CreateAppPath(argv[0]); within CFG_Load()
use it
snprintf(pathname, sizeof(pathname), "%sconfig.txt", CFG.appPath);

*snip from somewhere*
void CreateAppPath(char origpath[])
{
    char path[1024];
    strcpy(path, origpath); // make a copy so we don't mess up original

    char * loc;
    int pos = -1;

    loc = strrchr(path,'/');
    if (loc != NULL)
        *loc = 0; // strip file name

    loc = strchr(path,'/'); // looking for / from fat:/
    if (loc != NULL)
        pos = loc - path + 1;

    if(pos >= 0 && pos < 1024)
        snprintf(CFG.appPath, sizeof(CFG.appPath ), "SD:/%s/", &(path[pos]));
}

Original issue reported on code.google.com by myron0...@gmx.net on 1 May 2009 at 2:58

GoogleCodeExporter commented 9 years ago
the set folder "sd:/config/" is used so that wads would run without a problem 
since
they can't have the config on the nand

Original comment by shaneste...@gmail.com on 1 May 2009 at 4:21

GoogleCodeExporter commented 9 years ago
ok, i c.
But with this release cycle (20 revisions a day) no one would ever really use 
this in
a wad -> WAD forwarder. (it would take longer to create the wad, than a new 
revision
pops up :D)

Anyway:
What about an other logic?!
Could the usbloader first try to read the config file from the application 
root, and
then from the default path as fallback (if not existent)? This would solve
everybody's needs :)

(dunno what argv[0] looks like when called from nand, but if nothing is found, 
the
fallback comes in)

Original comment by myron0...@gmx.net on 1 May 2009 at 5:56

GoogleCodeExporter commented 9 years ago
actually I would like to see a universal use of
SD:/data/app_name/
and in this case
SD:/data/usbloader-gui/

Original comment by marino...@gmail.com on 1 May 2009 at 11:48

GoogleCodeExporter commented 9 years ago
I vote for this:  "Could the usbloader first try to read the config file from 
the
application root, and then from the default path as fallback (if not existent)? 
This
would solve everybody's needs :)"

Original comment by timebomb4u2@gmail.com on 2 May 2009 at 1:36

GoogleCodeExporter commented 9 years ago

Original comment by giantpune@gmail.com on 10 May 2009 at 7:26