Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e6445c

Browse files
committed
Don't add the library file to the resource file chain if it is the
same as the application file (Just).
1 parent 7e1fb7c commit 2e6445c

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Mac/Python/macshlglue.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ __initialize_with_resources(CFragInitBlockPtr data)
8282
return noErr;
8383
}
8484

85+
/*
86+
** compare two FSSpecs, return true if equal, false if different
87+
** XXX where could this function live? (jvr)
88+
*/
89+
90+
static int
91+
FSpCompare(FSSpec *fss1, FSSpec *fss2) {
92+
if (fss1->vRefNum != fss2->vRefNum)
93+
return 0;
94+
if (fss1->parID != fss2->parID)
95+
return 0;
96+
return !PLstrcmp(fss1->name, fss2->name);
97+
}
98+
99+
/* XXX can't include "macglue.h" somehow (jvr) */
100+
extern FSSpec PyMac_ApplicationFSSpec; /* Application location (from macargv.c) */
101+
85102
/*
86103
** Insert the library resources into the search path. Put them after
87104
** the resources from the application (which we assume is the current
@@ -90,7 +107,7 @@ __initialize_with_resources(CFragInitBlockPtr data)
90107
void
91108
PyMac_AddLibResources()
92109
{
93-
if ( !library_fss_valid )
110+
if ( !library_fss_valid || FSpCompare(&library_fss, &PyMac_ApplicationFSSpec))
94111
return;
95112
(void)FSpOpenResFile(&library_fss, fsRdPerm);
96113
}

0 commit comments

Comments
 (0)