Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macgetpath.c @ 8666:6245b819bdd8 legacy-trunk
If the preference filename resource is empty don't try to open or
create the preferences file. This is so that frozen programs don't
interfere with an existing Python installation, or leave turds in the
Preferences folder.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Mon, 13 Jul 1998 13:38:29 +0000 |
| parents | 7356d4888a8b |
| children | d642e6748d12 |
line wrap: on
line diff
--- a/Mac/Python/macgetpath.c Mon Jul 13 13:37:12 1998 +0000 +++ b/Mac/Python/macgetpath.c Mon Jul 13 13:38:29 1998 +0000 @@ -65,10 +65,11 @@ :Lib:test\n\ :Lib:mac" -static void +static int getpreffilefss(FSSpec *fssp) { static int diditbefore=0; + static int rv = 1; static FSSpec fss; short prefdirRefNum; long prefdirDirID; @@ -88,12 +89,19 @@ } HLock(namehandle); - (void)FSMakeFSSpec(prefdirRefNum, prefdirDirID, (unsigned char *)*namehandle, &fss); + if ( **namehandle == '\0' ) { + /* Empty string means don't use preferences file */ + rv = 0; + } else { + /* There is a filename, construct the fsspec */ + (void)FSMakeFSSpec(prefdirRefNum, prefdirDirID, (unsigned char *)*namehandle, &fss); + } HUnlock(namehandle); ReleaseResource(namehandle); diditbefore = 1; } *fssp = fss; + return rv; } char * @@ -162,7 +170,8 @@ short prefrh; OSErr err; - getpreffilefss(&dirspec); + if ( !getpreffilefss(&dirspec)) + return -1; prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm); if ( prefrh < 0 ) { #if 0 @@ -225,7 +234,7 @@ prefrh = PyMac_OpenPrefFile(); handle = (AliasHandle)Get1Resource('alis', PYTHONHOME_ID); if ( handle == NULL ) { - (void)StopAlert(BADPREFFILE_ID, NULL); + /* (void)StopAlert(BADPREFFILE_ID, NULL); */ diditbefore=1; return ":"; }
