diff options
Diffstat (limited to 'Mac/Modules/file/filesupport.py')
-rw-r--r-- | Mac/Modules/file/filesupport.py | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py index 9fa8edd..f06bbb8 100644 --- a/Mac/Modules/file/filesupport.py +++ b/Mac/Modules/file/filesupport.py @@ -225,32 +225,10 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) return 1; } PyErr_Clear(); -#if !TARGET_API_MAC_OSX - /* On OS9 we now try a pathname */ - if ( PyString_Check(v) ) { - /* It's a pathname */ - if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) ) - return 0; - refnum = 0; /* XXXX Should get CurWD here?? */ - parid = 0; - err = FSMakeFSSpec(refnum, parid, path, spec); - if ( err && err != fnfErr ) { - PyMac_Error(err); - return 0; - } - return 1; - } - PyErr_Clear(); -#endif /* Otherwise we try to go via an FSRef. On OSX we go all the way, ** on OS9 we accept only a real FSRef object */ -#if TARGET_API_MAC_OSX if ( PyMac_GetFSRef(v, &fsr) ) { -#else - if (FSRef_Check(v)) { - fsr = ((FSRefObject *)v)->ob_itself; -#endif err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL); if (err != noErr) { PyMac_Error(err); @@ -258,9 +236,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) } return 1; } -#if !TARGET_API_MAC_OSX - PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required"); -#endif return 0; } @@ -275,7 +250,6 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } -#if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; @@ -288,14 +262,9 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } /* XXXX Should try unicode here too */ -#endif /* Otherwise we try to go via an FSSpec */ -#if TARGET_API_MAC_OSX if (FSSpec_Check(v)) { fss = ((FSSpecObject *)v)->ob_itself; -#else - if (PyMac_GetFSSpec(v, &fss)) { -#endif if ((err=FSpMakeFSRef(&fss, fsr)) == 0) return 1; PyMac_Error(err); @@ -814,26 +783,9 @@ f.docstring = lambda: "() -> string" fsref_methods.append(f) FSRef_as_pathname_body = """ -#if TARGET_API_MAC_OSX if (!PyArg_ParseTuple(_args, "")) return NULL; _res = FSRef_FSRefMakePath(_self, _args); -#else -char strbuf[1024]; -OSErr err; -FSSpec fss; - -if (!PyArg_ParseTuple(_args, "")) - return NULL; -if ( !PyMac_GetFSSpec((PyObject *)_self, &fss)) - return NULL; -err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf)); -if ( err ) { - PyMac_Error(err); - return NULL; -} -_res = PyString_FromString(strbuf); -#endif return _res; """ f = ManualGenerator("as_pathname", FSRef_as_pathname_body) |