In MachoPython, don't simulate argc/argv unless we have argc=1 and argv[1]

starts with "-psn_". This means the drag-and-drop continues to work as
expected, but we can now also do
/Applications/Python.app/Contents/MacOS/python script.py
from the command line, which is a lot easier with debugging. Pressing <option>
at this point also has the expected effect of opening the options dialog!
This commit is contained in:
Jack Jansen 2002-01-02 22:53:38 +00:00
parent 1142d595ee
commit 4b517854d0
1 changed files with 8 additions and 2 deletions

View File

@ -316,8 +316,14 @@ init_common(int *argcp, char ***argvp, int embedded)
*argcp = 1; *argcp = 1;
*argvp = emb_argv; *argvp = emb_argv;
} else { } else {
/* Create argc/argv. Do it before we go into the options event loop. */ /* Create argc/argv. Do it before we go into the options event loop.
*argcp = PyMac_GetArgv(argvp, PyMac_options.noargs); ** In MachoPython we skip this step if we already have plausible
** command line arguments.
*/
#if TARGET_API_MAC_OSX
if (*argcp == 2 && strncmp((*argvp)[1], "-psn_", 5) == 0)
#endif
*argcp = PyMac_GetArgv(argvp, PyMac_options.noargs);
#if !TARGET_API_MAC_OSX #if !TARGET_API_MAC_OSX
#ifndef NO_ARGV0_CHDIR #ifndef NO_ARGV0_CHDIR
if (*argcp >= 1 && (*argvp)[0] && (*argvp)[0][0]) { if (*argcp >= 1 && (*argvp)[0] && (*argvp)[0][0]) {