diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-18 09:40:39 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-07-18 09:40:39 (GMT) |
commit | 660bb1d1c792f419a60f779c41d9d39d0dfe2b20 (patch) | |
tree | b52ab129553b2e3b0eec48a091828c70b7bdaaaf /Mac/Python | |
parent | 574c0e22a56ef1b4b61f99088a38aa3fe9fbc840 (diff) | |
download | cpython-660bb1d1c792f419a60f779c41d9d39d0dfe2b20.zip cpython-660bb1d1c792f419a60f779c41d9d39d0dfe2b20.tar.gz cpython-660bb1d1c792f419a60f779c41d9d39d0dfe2b20.tar.bz2 |
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.
Diffstat (limited to 'Mac/Python')
-rw-r--r-- | Mac/Python/macmain.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index d40a70e..20dd4cb 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -256,7 +256,22 @@ init_common(int *argcp, char ***argvp, int embedded) } 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); } |