Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
388:4e9044b378fd | 389:ca655a7a9d80 |
---|---|
49 @implementation SDLMain | 49 @implementation SDLMain |
50 | 50 |
51 /* Set the working directory to the .app's parent directory */ | 51 /* Set the working directory to the .app's parent directory */ |
52 - (void) setupWorkingDirectory:(BOOL)shouldChdir | 52 - (void) setupWorkingDirectory:(BOOL)shouldChdir |
53 { | 53 { |
54 char parentdir[MAXPATHLEN]; | |
55 char *c; | |
56 | |
57 strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); | |
58 c = (char*) parentdir; | |
59 | |
60 while (*c != '\0') /* go to end */ | |
61 c++; | |
62 | |
63 while (*c != '/') /* back up to parent */ | |
64 c--; | |
65 | |
66 *c++ = '\0'; /* cut off last part (binary name) */ | |
67 | |
54 if (shouldChdir) | 68 if (shouldChdir) |
55 { | 69 { |
56 char parentdir[MAXPATHLEN]; | |
57 char *c; | |
58 | |
59 strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); | |
60 c = (char*) parentdir; | |
61 | |
62 while (*c != '\0') /* go to end */ | |
63 c++; | |
64 | |
65 while (*c != '/') /* back up to parent */ | |
66 c--; | |
67 | |
68 *c++ = '\0'; /* cut off last part (binary name) */ | |
69 | |
70 assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ | 70 assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ |
71 assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ | 71 assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */ |
72 } | 72 } |
73 } | 73 } |
74 | 74 |