From d48b10621e53c780be016c2d51fd2165d7c8f4a5 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sun, 13 Jan 2002 23:16:32 +0000 Subject: In MachoPython expect Unix-style pathnames for both FSSpec and FSRef initializers. TBD: Do the reverse for MacPython, and also handle as_pathname(). --- Mac/Modules/macfsmodule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 6dba578..2c4f2b3 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -1189,11 +1189,21 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *fs) if (_mfs_GetFSSpecFromFSRef(v, fs)) return 1; if ( PyString_Check(v) ) { +#if TARGET_API_MAC_OSX + FSRef fsr; + + if ( !PyMac_GetFSRef(v, &fsr) ) + return 0; + if ( FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, fs, NULL) == noErr ) + return 1; + return 0; +#else /* It's a pathname */ if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) ) return 0; refnum = 0; /* XXXX Should get CurWD here?? */ parid = 0; +#endif } else { if( !PyArg_Parse(v, "(hlO&); FSSpec should be FSSpec, FSRef, fullpath or (vrefnum,dirid,path)", &refnum, &parid, PyMac_GetStr255, &path)) { -- cgit v0.12