diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1998-09-07 11:36:17 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1998-09-07 11:36:17 (GMT) |
commit | 48a9c3634b2abd71fafc8657ea29c353ddc9dfb4 (patch) | |
tree | ad6936865102723d6e2df8c57056119c7423f942 | |
parent | 981998399487f1ea102a131d457b73eca0b987d1 (diff) | |
download | cpython-48a9c3634b2abd71fafc8657ea29c353ddc9dfb4.zip cpython-48a9c3634b2abd71fafc8657ea29c353ddc9dfb4.tar.gz cpython-48a9c3634b2abd71fafc8657ea29c353ddc9dfb4.tar.bz2 |
Mods by Just to allow aliases in sys.path entries
-rw-r--r-- | Mac/Python/macimport.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Mac/Python/macimport.c b/Mac/Python/macimport.c index f5f4e20..627f828 100644 --- a/Mac/Python/macimport.c +++ b/Mac/Python/macimport.c @@ -48,6 +48,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif #include <CodeFragments.h> +#ifdef USE_GUSI +#include "TFileSpec.h" /* for Path2FSSpec() */ +#endif + typedef void (*dl_funcptr)(); #define FUNCNAME_PATTERN "init%.200s" @@ -100,7 +104,11 @@ findnamedresource( UseResFile(PyMac_AppRefNum); filerh = -1; } else { +#ifdef USE_GUSI + if ( Path2FSSpec(filename, &fss) != noErr || +#else if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr || +#endif FSpGetFInfo(&fss, &finfo) != noErr ) { #ifdef INTERN_STRINGS if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) @@ -296,7 +304,12 @@ char *filename; UseResFile(PyMac_AppRefNum); filerh = -1; } else { +#ifdef USE_GUSI + if ( (err=Path2FSSpec(filename, &fss)) != noErr || + FSpGetFInfo(&fss, &finfo) != noErr ) +#else if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) +#endif goto error; if ( (err=FSpGetFInfo(&fss, &finfo)) != noErr ) goto error; @@ -401,6 +414,7 @@ PyMac_FindModuleExtension(char *buf, int *lenp, char *module) unsigned char fnbuf[64]; int modnamelen = strlen(module); FSSpec fss; + FInfo finfo; short refnum; long dirid; @@ -419,8 +433,14 @@ PyMac_FindModuleExtension(char *buf, int *lenp, char *module) #else strcpy(buf+*lenp, _PyImport_Filetab[0].suffix); #endif +#ifdef USE_GUSI + if ( Path2FSSpec(buf, &fss) == noErr && + FSpGetFInfo(&fss, &finfo) == noErr) + return _PyImport_Filetab; +#else if ( FSMakeFSSpec(0, 0, Pstring(buf), &fss) == noErr ) return _PyImport_Filetab; +#endif /* ** We cannot check for fnfErr (unfortunately), it can mean either that ** the file doesn't exist (fine, we try others) or the path leading to it. |