diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1996-09-05 15:19:24 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1996-09-05 15:19:24 (GMT) |
commit | f12e7093d5307bd8ce1cb82f767ead5be5e88e5c (patch) | |
tree | b50e86c653bb4c1169fd4e2c2b0778b64662f225 /Mac/Python/macgetpath.c | |
parent | b9bf6e2ddec61365e1c2bbd1003cd6c7b7097e7a (diff) | |
download | cpython-f12e7093d5307bd8ce1cb82f767ead5be5e88e5c.zip cpython-f12e7093d5307bd8ce1cb82f767ead5be5e88e5c.tar.gz cpython-f12e7093d5307bd8ce1cb82f767ead5be5e88e5c.tar.bz2 |
Check that our override pythonpath is actually coming from the
application, not from some system extension that happens to use the
same resource id.
Diffstat (limited to 'Mac/Python/macgetpath.c')
-rw-r--r-- | Mac/Python/macgetpath.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c index 40dd6c1..0e3341d 100644 --- a/Mac/Python/macgetpath.c +++ b/Mac/Python/macgetpath.c @@ -210,6 +210,21 @@ char *dir; Str255 pathitem; int resource_id; OSErr err; + Handle h; + + /* + ** This is a bit tricky. We check here whether the current resource file + ** contains an override. This is to forestall us finding another STR# resource + ** with "our" id and using that for path initialization + */ + SetResLoad(0); + if ( (h=Get1Resource('STR#', PYTHONPATHOVERRIDE_ID)) ) { + ReleaseResource(h); + resource_id = PYTHONPATHOVERRIDE_ID; + } else { + resource_id = PYTHONPATH_ID; + } + SetResLoad(1); /* ** Remember old resource file and try to open preferences file @@ -229,14 +244,7 @@ char *dir; if( (rv = malloc(2)) == NULL ) goto out; strcpy(rv, "\n"); - /* - ** See whether there's an override. - */ - GetIndString(pathitem, PYTHONPATHOVERRIDE_ID, 1); - if ( pathitem[0] ) - resource_id = PYTHONPATHOVERRIDE_ID; - else - resource_id = PYTHONPATH_ID; + for(i=1; ; i++) { GetIndString(pathitem, resource_id, i); if( pathitem[0] == 0 ) |