[Python-checkins] python/dist/src/Mac/Modules macfsmodule.c,1.56,1.57
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Tue, 06 Aug 2002 05:59:52 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv2710
Modified Files:
macfsmodule.c
Log Message:
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.
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** macfsmodule.c 17 Jul 2002 16:30:34 -0000 1.56
--- macfsmodule.c 6 Aug 2002 12:59:44 -0000 1.57
***************
*** 40,43 ****
--- 40,50 ----
#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"
***************
*** 593,602 ****
OSErr err;
mfsiobject *fip;
!
!
if (!PyArg_ParseTuple(args, ""))
return NULL;
if ( (fip=newmfsiobject()) == NULL )
return NULL;
err = FSpGetFInfo(&self->fsspec, &fip->finfo);
if ( err ) {
--- 600,623 ----
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 ) {
***************
*** 605,608 ****
--- 626,630 ----
return NULL;
}
+ #endif
return (PyObject *)fip;
}