Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macimport.c @ 9073:618fb830be65 legacy-trunk
Mods by Just to allow aliases in sys.path entries
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Mon, 07 Sep 1998 11:36:17 +0000 |
| parents | ff1a8a38f8c1 |
| children | 462ccd0bbe50 |
line wrap: on
line diff
--- a/Mac/Python/macimport.c Fri Sep 04 21:20:29 1998 +0000 +++ b/Mac/Python/macimport.c Mon Sep 07 11:36:17 1998 +0000 @@ -48,6 +48,10 @@ #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 @@ 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 @@ 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 @@ unsigned char fnbuf[64]; int modnamelen = strlen(module); FSSpec fss; + FInfo finfo; short refnum; long dirid; @@ -419,8 +433,14 @@ #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.
