Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d48b106

Browse files
committed
In MachoPython expect Unix-style pathnames for both FSSpec and FSRef initializers. TBD: Do the reverse for MacPython, and also handle as_pathname().
1 parent 51e77e1 commit d48b106

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Mac/Modules/macfsmodule.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,11 +1189,21 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *fs)
11891189
if (_mfs_GetFSSpecFromFSRef(v, fs))
11901190
return 1;
11911191
if ( PyString_Check(v) ) {
1192+
#if TARGET_API_MAC_OSX
1193+
FSRef fsr;
1194+
1195+
if ( !PyMac_GetFSRef(v, &fsr) )
1196+
return 0;
1197+
if ( FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, fs, NULL) == noErr )
1198+
return 1;
1199+
return 0;
1200+
#else
11921201
/* It's a pathname */
11931202
if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
11941203
return 0;
11951204
refnum = 0; /* XXXX Should get CurWD here?? */
11961205
parid = 0;
1206+
#endif
11971207
} else {
11981208
if( !PyArg_Parse(v, "(hlO&); FSSpec should be FSSpec, FSRef, fullpath or (vrefnum,dirid,path)",
11991209
&refnum, &parid, PyMac_GetStr255, &path)) {

0 commit comments

Comments
 (0)