Mercurial > sdl-ios-xcode
diff src/main/macosx/SDLMain.m @ 389:ca655a7a9d80
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 01 Jun 2002 19:54:15 +0000 |
parents | 4e9044b378fd |
children | 19e73568a75c |
line wrap: on
line diff
--- a/src/main/macosx/SDLMain.m Sat Jun 01 19:51:08 2002 +0000 +++ b/src/main/macosx/SDLMain.m Sat Jun 01 19:54:15 2002 +0000 @@ -51,22 +51,22 @@ /* Set the working directory to the .app's parent directory */ - (void) setupWorkingDirectory:(BOOL)shouldChdir { + char parentdir[MAXPATHLEN]; + char *c; + + strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); + c = (char*) parentdir; + + while (*c != '\0') /* go to end */ + c++; + + while (*c != '/') /* back up to parent */ + c--; + + *c++ = '\0'; /* cut off last part (binary name) */ + if (shouldChdir) { - char parentdir[MAXPATHLEN]; - char *c; - - strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); - c = (char*) parentdir; - - while (*c != '\0') /* go to end */ - c++; - - while (*c != '/') /* back up to parent */ - c--; - - *c++ = '\0'; /* cut off last part (binary name) */ - assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ }