diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-01-13 23:16:32 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-01-13 23:16:32 (GMT) |
commit | d48b10621e53c780be016c2d51fd2165d7c8f4a5 (patch) | |
tree | 9d30432db54b6b2b50735777f4f519a9192b3eb1 /Mac/Modules | |
parent | 51e77e1324a8918a59362bf5c248daf5acd04c1d (diff) | |
download | cpython-d48b10621e53c780be016c2d51fd2165d7c8f4a5.zip cpython-d48b10621e53c780be016c2d51fd2165d7c8f4a5.tar.gz cpython-d48b10621e53c780be016c2d51fd2165d7c8f4a5.tar.bz2 |
In MachoPython expect Unix-style pathnames for both FSSpec and FSRef initializers. TBD: Do the reverse for MacPython, and also handle as_pathname().
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/macfsmodule.c | 10 |
1 files changed, 10 insertions, 0 deletions
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)) { |