diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-01-18 16:13:15 +0000 |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-01-18 16:13:15 +0000 |
commit | 54505524943ea7eb8f884848f0e279db5c7b58b1 (patch) | |
tree | d9ac4a1ba9be08b843d67934a0fc1ccc74515fc9 /Mac | |
parent | 9addc054353026de90e126a9e99ddd108561c3fa (diff) | |
download | cpython-54505524943ea7eb8f884848f0e279db5c7b58b1.tar.gz |
Added as_pathname() method to FSRef objects.
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Modules/macfsmodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 2c4f2b3f59..b00f5dd195 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -773,10 +773,26 @@ mfsr_as_fsspec(mfsrobject *self, PyObject *args) return (PyObject *)newmfssobject(&fss); } +static PyObject * +mfsr_as_pathname(mfsrobject *self, PyObject *args) +{ + char strbuf[PATHNAMELEN]; + OSStatus err; + + if (!PyArg_ParseTuple(args, "")) + return NULL; + err = FSRefMakePath(&self->fsref, strbuf, PATHNAMELEN); + if ( err ) { + PyErr_Mac(ErrorObject, err); + return NULL; + } + return PyString_FromString(strbuf); +} + static struct PyMethodDef mfsr_methods[] = { {"as_fsspec", (PyCFunction)mfsr_as_fsspec, 1}, + {"as_pathname", (PyCFunction)mfsr_as_pathname, 1}, #if 0 - {"as_pathname", (PyCFunction)mfss_as_pathname, 1}, {"as_tuple", (PyCFunction)mfss_as_tuple, 1}, {"NewAlias", (PyCFunction)mfss_NewAlias, 1}, {"NewAliasMinimal", (PyCFunction)mfss_NewAliasMinimal, 1}, |