mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
- The prefs file wasn't updated correctly if it already existed.
- Guido's r1.23 fix wrt PyMac_DoYieldEnabled had somehow gotten lost.
This commit is contained in:
parent
e08dea19c2
commit
45ff77f43e
1 changed files with 10 additions and 5 deletions
|
|
@ -400,7 +400,7 @@ PyMac_GetPythonDir()
|
||||||
static char name[256];
|
static char name[256];
|
||||||
AliasHandle handle;
|
AliasHandle handle;
|
||||||
FSSpec dirspec;
|
FSSpec dirspec;
|
||||||
int ok = 0, exists = 0;
|
int ok = 0;
|
||||||
Boolean modified = 0, cannotmodify = 0;
|
Boolean modified = 0, cannotmodify = 0;
|
||||||
short oldrh, prefrh;
|
short oldrh, prefrh;
|
||||||
short prefdirRefNum;
|
short prefdirRefNum;
|
||||||
|
|
@ -425,6 +425,7 @@ PyMac_GetPythonDir()
|
||||||
FSpCreateResFile(&dirspec, 'PYTH', 'pref', 0);
|
FSpCreateResFile(&dirspec, 'PYTH', 'pref', 0);
|
||||||
prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm);
|
prefrh = FSpOpenResFile(&dirspec, fsRdWrShPerm);
|
||||||
if ( prefrh == -1 ) {
|
if ( prefrh == -1 ) {
|
||||||
|
/* This is strange, what should we do now? */
|
||||||
cannotmodify = 1;
|
cannotmodify = 1;
|
||||||
} else {
|
} else {
|
||||||
UseResFile(prefrh);
|
UseResFile(prefrh);
|
||||||
|
|
@ -435,9 +436,9 @@ PyMac_GetPythonDir()
|
||||||
handle = (AliasHandle)Get1Resource('alis', 128);
|
handle = (AliasHandle)Get1Resource('alis', 128);
|
||||||
if ( handle ) {
|
if ( handle ) {
|
||||||
/* It exists. Resolve it (possibly updating it) */
|
/* It exists. Resolve it (possibly updating it) */
|
||||||
if ( ResolveAlias(NULL, handle, &dirspec, &modified) == noErr )
|
if ( ResolveAlias(NULL, handle, &dirspec, &modified) == noErr ) {
|
||||||
ok = 1;
|
ok = 1;
|
||||||
exists = 1;
|
}
|
||||||
}
|
}
|
||||||
if ( !ok ) {
|
if ( !ok ) {
|
||||||
/* No luck, so far. ask the user for help */
|
/* No luck, so far. ask the user for help */
|
||||||
|
|
@ -456,10 +457,14 @@ PyMac_GetPythonDir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( handle ) {
|
||||||
|
/* Set the (old, invalid) alias record to the new data */
|
||||||
|
UpdateAlias(NULL, &dirspec, handle, &modified);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( ok && modified && !cannotmodify) {
|
if ( ok && modified && !cannotmodify) {
|
||||||
/* We have a new, valid fsspec and we can update the preferences file. Do so. */
|
/* We have a new, valid fsspec and we can update the preferences file. Do so. */
|
||||||
if ( !exists ) {
|
if ( !handle ) {
|
||||||
if (NewAlias(NULL, &dirspec, &handle) == 0 )
|
if (NewAlias(NULL, &dirspec, &handle) == 0 )
|
||||||
AddResource((Handle)handle, 'alis', 128, "\p");
|
AddResource((Handle)handle, 'alis', 128, "\p");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -879,9 +884,9 @@ PyMac_InitApplication()
|
||||||
endp = strrchr(curwd, ':');
|
endp = strrchr(curwd, ':');
|
||||||
if ( endp && endp > curwd ) {
|
if ( endp && endp > curwd ) {
|
||||||
*endp = '\0';
|
*endp = '\0';
|
||||||
|
|
||||||
chdir(curwd);
|
chdir(curwd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Py_Main(argc, argv);
|
Py_Main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue