Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macgetargv.c @ 19841:d8dd75e3b304 legacy-trunk
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
parameter for the return string (as unix pathnames are not limited
by the 255 char pstring limit).
Implemented the function for MachO-Python, where it returns unix pathnames.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Mon, 10 Sep 2001 22:00:39 +0000 |
| parents | c93d7d0857a2 |
| children | b9246f8fb8fd 74d1ad61f843 |
line wrap: on
line diff
--- a/Mac/Python/macgetargv.c Mon Sep 10 21:45:42 2001 +0000 +++ b/Mac/Python/macgetargv.c Mon Sep 10 22:00:39 2001 +0000 @@ -54,10 +54,16 @@ #include "Python.h" #include "macglue.h" +#ifdef TARGET_API_MAC_OSX +#define PATHNAMELEN 1024 +#else +#define PATHNAMELEN 256 +#endif + static int arg_count; static char *arg_vector[256]; FSSpec PyMac_ApplicationFSSpec; -char PyMac_ApplicationPath[256]; +char PyMac_ApplicationPath[PATHNAMELEN]; /* Duplicate a string to the heap. We also export this since it isn't standard ** and others use it @@ -73,22 +79,6 @@ } #endif -#if TARGET_API_MAC_OSX -OSErr -PyMac_GetFullPath(FSSpec *fss, char *path) -{ - FSRef fsr; - OSErr err; - - *path = '\0'; - err = FSpMakeFSRef(fss, &fsr); - if ( err ) return err; - err = (OSErr)FSRefMakePath(&fsr, path, 1024); - if ( err ) return err; - return 0; -} -#endif /* TARGET_API_MAC_OSX */ - #if !TARGET_API_MAC_OSX /* Initialize FSSpec and full name of current application */ @@ -109,7 +99,7 @@ info.processAppSpec = &PyMac_ApplicationFSSpec; if ( err=GetProcessInformation(¤tPSN, &info)) return err; - if ( err=PyMac_GetFullPath(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath) ) + if ( err=PyMac_GetFullPathname(&PyMac_ApplicationFSSpec, PyMac_ApplicationPath, PATHNAMELEN) ) return err; applocation_inited = 1; return 0; @@ -170,7 +160,7 @@ DescType rttype; long i, ndocs, size; FSSpec fss; - char path[1024]; + char path[PATHNAMELEN]; got_one = 1; if ((err = AEGetParamDesc(theAppleEvent, @@ -185,7 +175,7 @@ &keywd, &rttype, &fss, sizeof(fss), &size); if (err) break; - PyMac_GetFullPath(&fss, path); + PyMac_GetFullPathname(&fss, path, PATHNAMELEN); arg_vector[arg_count++] = strdup(path); } return err;
