set default device so relative paths work in 3dmoo

This commit is contained in:
Dave Murphy 2014-12-08 23:21:09 +00:00
parent 4b4b781ec3
commit 88bef35b8f

View File

@ -140,15 +140,18 @@ Result sdmcInit(void)
int dev = AddDevice(&sdmc_devoptab); int dev = AddDevice(&sdmc_devoptab);
if (__system_argc != 0 && __system_argv[0] != NULL) if (dev != -1) {
{ setDefaultDevice(dev);
if (FindDevice(__system_argv[0]) == dev) if (__system_argc != 0 && __system_argv[0] != NULL)
{ {
strncpy(__fixedpath,__system_argv[0],PATH_MAX); if (FindDevice(__system_argv[0]) == dev)
char *last_slash = strrchr(__fixedpath,'/'); {
if (last_slash != NULL) { strncpy(__fixedpath,__system_argv[0],PATH_MAX);
last_slash[0] = 0; char *last_slash = strrchr(__fixedpath,'/');
chdir(__fixedpath); if (last_slash != NULL) {
last_slash[0] = 0;
chdir(__fixedpath);
}
} }
} }
} }