mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 18:09:17 +01:00
correct initial path setting from argv
This commit is contained in:
parent
25b615836f
commit
a839587b4d
@ -112,14 +112,17 @@ bool fatInit (u32 cacheSize, bool setAsDefaultDevice) {
|
|||||||
char filePath[MAXPATHLEN * 2] = "fat:/";
|
char filePath[MAXPATHLEN * 2] = "fat:/";
|
||||||
#ifndef GBA
|
#ifndef GBA
|
||||||
if ( __system_argv->argvMagic == ARGV_MAGIC && __system_argv->argc >= 1 ) {
|
if ( __system_argv->argvMagic == ARGV_MAGIC && __system_argv->argc >= 1 ) {
|
||||||
char ch, *ptr = filePath, *lastSlash = NULL;
|
|
||||||
|
if ( !strncasecmp( __system_argv->argv[0], "fat", 3)) {
|
||||||
|
|
||||||
strcpy(filePath, __system_argv->argv[0]);
|
strcpy(filePath, __system_argv->argv[0]);
|
||||||
do {
|
char *lastSlash = strrchr( filePath, '/' );
|
||||||
ch = *(ptr);
|
|
||||||
if (ch == '/') lastSlash=ptr;
|
if ( NULL != lastSlash) {
|
||||||
ptr++;
|
if ( *(lastSlash - 1) == ':') lastSlash++;
|
||||||
} while (ch);
|
*lastSlash = 0;
|
||||||
if ( NULL != lastSlash) *lastSlash = 0;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
chdir (filePath);
|
chdir (filePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user