Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macmain.c @ 13638:58398c0f948b legacy-trunk
MacPython on MacOSX DP4 gets started in the wrong directory. The workaround (ifdeffed by USE_ARGV0_CHDIR) is to do a chdir() to the folder part of our executable name.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Tue, 18 Jul 2000 09:40:39 +0000 |
| parents | a901c2c0166b |
| children | f840bf6a3351 |
line wrap: on
line diff
--- a/Mac/Python/macmain.c Tue Jul 18 09:40:08 2000 +0000 +++ b/Mac/Python/macmain.c Tue Jul 18 09:40:39 2000 +0000 @@ -256,7 +256,22 @@ } else { /* Create argc/argv. Do it before we go into the options event loop. */ *argcp = PyMac_GetArgv(argvp, options.noargs); - +#ifdef USE_ARGV0_CHDIR + printf("argc=%d, argv[0]=%x=%s\n", *argcp, (*argvp)[0], (*argvp)[0]); + if (*argcp >= 1 && (*argvp)[0] && (*argvp)[0][0]) { + /* Workaround for MacOS X, which currently (DP4) doesn't set + ** the working folder correctly + */ + char app_wd[256], *p; + + strncpy(app_wd, (*argvp)[0], 256); + printf("Modifying dir, argv[0]=%s\n", (*argvp)[0]); + p = strrchr(app_wd, ':'); + if ( p ) *p = 0; + printf("app_wd=%s\n", app_wd); + chdir(app_wd); + } +#endif /* Do interactive option setting, if allowed and <option> depressed */ PyMac_InteractiveOptions(&options, argcp, argvp); }
