summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-08-06 12:59:44 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-08-06 12:59:44 (GMT)
commit9c5b61b21bae24bdfc168b5876dbe1396c28868a (patch)
tree17c21745582326f62b73603a84c5524d43ea3ff7 /Mac/Modules
parent137d8c566741e5681cd8d8e5a29fe226cbd11b9d (diff)
downloadcpython-9c5b61b21bae24bdfc168b5876dbe1396c28868a.zip
cpython-9c5b61b21bae24bdfc168b5876dbe1396c28868a.tar.gz
cpython-9c5b61b21bae24bdfc168b5876dbe1396c28868a.tar.bz2
Patch #567296 by Pim Buurman, slightly modified by me so it can be disabled
at compile time: use PBGetCatInfoSync() to get FInfo data in stead of GetFInfo. The latter doesn't work for folders. The former does, at least on OSX, and insofar the info makes sense for a folder.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/macfsmodule.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c
index 488dd7e..f8c3428 100644
--- a/Mac/Modules/macfsmodule.c
+++ b/Mac/Modules/macfsmodule.c
@@ -39,6 +39,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "getapplbycreator.h"
+/*
+** The next define uses PBGetCatInfoSync for GetFInfo, allowing you
+** to get FInfo for folders. This works on OSX, but it may result
+** in problems on OS9, hence the define (for the time being).
+*/
+#define USE_CATINFO_FOR_FINFO
+
#ifndef TARGET_API_MAC_OSX
#include "pythonresources.h"
extern PyMac_PrefRecord PyMac_options;
@@ -592,18 +599,33 @@ mfss_GetFInfo(mfssobject *self, PyObject *args)
{
OSErr err;
mfsiobject *fip;
-
-
+ CInfoPBRec pb;
+ FSSpec* fss = &self->fsspec;
+
if (!PyArg_ParseTuple(args, ""))
return NULL;
if ( (fip=newmfsiobject()) == NULL )
return NULL;
+#ifdef USE_CATINFO_FOR_FINFO
+ pb.dirInfo.ioNamePtr = fss->name;
+ pb.dirInfo.ioFDirIndex = 0;
+ pb.dirInfo.ioVRefNum = fss->vRefNum;
+ pb.dirInfo.ioDrDirID = fss->parID;
+ err = PBGetCatInfoSync(&pb);
+ if ( err ) {
+ PyErr_Mac(ErrorObject, err);
+ Py_DECREF(fip);
+ return NULL;
+ }
+ memcpy(&fip->finfo, &pb.hFileInfo.ioFlFndrInfo, sizeof(FileInfo));
+#else
err = FSpGetFInfo(&self->fsspec, &fip->finfo);
if ( err ) {
PyErr_Mac(ErrorObject, err);
Py_DECREF(fip);
return NULL;
}
+#endif
return (PyObject *)fip;
}