mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
parameter for the return string (as unix pathnames are not limited by the 255 char pstring limit). Implemented the function for MachO-Python, where it returns unix pathnames.
This commit is contained in:
parent
b0e8e9b72f
commit
697842f58c
6 changed files with 74 additions and 35 deletions
|
@ -51,6 +51,12 @@ extern PyObject *_PyMac_BuildFSRef(FSRef *);
|
|||
#endif
|
||||
static PyObject *ErrorObject;
|
||||
|
||||
#ifdef TARGET_API_MAC_OSX
|
||||
#define PATHNAMELEN 1024
|
||||
#else
|
||||
#define PATHNAMELEN 256
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
/* Declarations for objects of type Alias */
|
||||
|
||||
|
@ -449,22 +455,17 @@ PyMac_SetFileDates(FSSpec *fss, unsigned long crdat, unsigned long mddat,
|
|||
static PyObject *
|
||||
mfss_as_pathname(mfssobject *self, PyObject *args)
|
||||
{
|
||||
#if TARGET_API_MAC_OSX
|
||||
PyErr_SetString(PyExc_NotImplementedError, "FSSpec.as_pathname not supported on this platform");
|
||||
return 0;
|
||||
#else
|
||||
char strbuf[257];
|
||||
char strbuf[PATHNAMELEN];
|
||||
OSErr err;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
err = PyMac_GetFullPath(&self->fsspec, strbuf);
|
||||
err = PyMac_GetFullPathname(&self->fsspec, strbuf, PATHNAMELEN);
|
||||
if ( err ) {
|
||||
PyErr_Mac(ErrorObject, err);
|
||||
return NULL;
|
||||
}
|
||||
return PyString_FromString(strbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue