Issue706585
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003-03-19 22:49 by jackjansen, last changed 2022-04-10 16:07 by admin. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg60316 - (view) | Author: Jack Jansen (jackjansen) * | Date: 2003-03-19 22:49 | |
Carbon.File.FSCatalogInfo should expose the finder info (which is somehow defined as an anonymous short array in the header) as the correct Python object. Here's a comment by Mark Day: Yup, use the finderInfo. It's really either FileInfo or FolderInfo (both from Finder.h), depending on whether the object is a file or folder. Similarly, extFinderInfo is really either ExtendedFileInfo or ExtendedFolderInfo. I think there was some circular header dependency that prevented Files.h from using the Finder types explicitly. |
|||
msg60317 - (view) | Author: Gregory Ewing (gcewing) | Date: 2003-10-14 07:08 | |
Logged In: YES user_id=747684 Here's a patch for _Filemodule.c which exposes the finderInfo. It assumes it's always a FileInfo, which is not exactly right -- you may want to do things a bit more carefully. Also, someone with more knowledge of bgen than me will have to figure out what should really be patched and how. --- _Filemodule.c.orig Tue Oct 14 19:04:56 2003 +++ _Filemodule.c Sun Sep 21 13:41:04 2003 @@ -1,5 +1,10 @@ +/* + * This is a hacked version of _Filemodule.c from the Python 2.3 + * distribution to support access to the finderInfo field of the + * FSCatalogInfo data structure. + */ /* ========================== Module _File ========================== */ #include "Python.h" @@ -101,10 +106,23 @@ return Py_BuildValue("u#", itself->unicode, itself->length); } static PyObject *File_Error; +/* ----------------------- Object type FInfo declarations ------------------------ */ + +static PyTypeObject FInfo_Type; + +#define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) + +typedef struct FInfoObject { + PyObject_HEAD + FInfo ob_itself; +} FInfoObject; + +static PyObject *FInfo_New(FInfo *itself); + /* ------------------- Object type FSCatalogInfo -------------------- */ static PyTypeObject FSCatalogInfo_Type; #define FSCatalogInfo_Check(x) ((x)->ob_type == &FSCatalogInfo_Type || PyObject_TypeCheck((x), &FSCatalogInfo_Type)) @@ -329,10 +347,25 @@ { return PyArg_Parse(v, "b", &self->ob_itself.userPrivileges)-1; return 0; } +static PyObject *FSCatalogInfo_get_finderInfo(FSCatalogInfoObject *self, void *closure) +{ + return FInfo_New((FInfo *)self->ob_itself.finderInfo); +} + +static int FSCatalogInfo_set_finderInfo(FSCatalogInfoObject *self, PyObject *v, void *closure) +{ + if (!FInfo_Check(v)) { + PyErr_SetString(PyExc_TypeError, "Expected an FInfo object"); + return -1; + } + *(FInfo *)self->ob_itself.finderInfo = ((FInfoObject *)v)->ob_itself; + return 0; +} + static PyGetSetDef FSCatalogInfo_getsetlist[] = { {"nodeFlags", (getter)FSCatalogInfo_get_nodeFlags, (setter)FSCatalogInfo_set_nodeFlags, NULL}, {"volume", (getter)FSCatalogInfo_get_volume, (setter)FSCatalogInfo_set_volume, NULL}, {"parentDirID", (getter)FSCatalogInfo_get_parentDirID, (setter)FSCatalogInfo_set_parentDirID, NULL}, {"nodeID", (getter)FSCatalogInfo_get_nodeID, (setter)FSCatalogInfo_set_nodeID, NULL}, @@ -347,10 +380,11 @@ {"dataPhysicalSize", (getter)FSCatalogInfo_get_dataPhysicalSize, (setter)FSCatalogInfo_set_dataPhysicalSize, NULL}, {"rsrcLogicalSize", (getter)FSCatalogInfo_get_rsrcLogicalSize, (setter)FSCatalogInfo_set_rsrcLogicalSize, NULL}, {"rsrcPhysicalSize", (getter)FSCatalogInfo_get_rsrcPhysicalSize, (setter)FSCatalogInfo_set_rsrcPhysicalSize, NULL}, {"sharingFlags", (getter)FSCatalogInfo_get_sharingFlags, (setter)FSCatalogInfo_set_sharingFlags, NULL}, {"userPrivileges", (getter)FSCatalogInfo_get_userPrivileges, (setter)FSCatalogInfo_set_userPrivileges, NULL}, + {"finderInfo", (getter)FSCatalogInfo_get_finderInfo, (setter)FSCatalogInfo_set_finderInfo, NULL}, {NULL, NULL, NULL, NULL}, }; #define FSCatalogInfo_compare NULL @@ -460,20 +494,11 @@ }; /* ----------------- End object type FSCatalogInfo ------------------ */ -/* ----------------------- Object type FInfo ------------------------ */ - -static PyTypeObject FInfo_Type; - -#define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) - -typedef struct FInfoObject { - PyObject_HEAD - FInfo ob_itself; -} FInfoObject; +/* ----------------------- Object type FInfo implementation ------------------------ */ static PyObject *FInfo_New(FInfo *itself) { FInfoObject *it; if (itself == NULL) return PyMac_Error(resNotFound); |
|||
msg60318 - (view) | Author: Jack Jansen (jackjansen) * | Date: 2003-10-14 10:07 | |
Logged In: YES user_id=45365 Greg, could you attach the patch, in stead of having it inline? An inline patch is very difficult to get out of SF unscathed... |
|||
msg81851 - (view) | Author: Daniel Diniz (ajaksu2) * | Date: 2009-02-13 02:36 | |
Can anyone salvage Gregory's inline patch? |
|||
msg82327 - (view) | Author: Ronald Oussoren (ronaldoussoren) * | Date: 2009-02-17 12:17 | |
I'm closing this as "wont fix" because the Carbon bindings are deprecated and are removed in Python 3.0. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:07:47 | admin | set | github: 38185 |
2009-02-17 12:17:22 | ronaldoussoren | set | status: open -> closed nosy: + ronaldoussoren resolution: wont fix messages: + msg82327 |
2009-02-13 02:36:41 | ajaksu2 | set | versions:
+ Python 2.7 nosy: + ajaksu2 messages: + msg81851 keywords: + patch type: enhancement stage: test needed |
2003-03-19 22:49:05 | jackjansen | create |