mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Added FindFolder interface
This commit is contained in:
parent
08305504f1
commit
2c67362f70
1 changed files with 24 additions and 0 deletions
|
@ -28,6 +28,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <Memory.h>
|
#include <Memory.h>
|
||||||
#include <Files.h>
|
#include <Files.h>
|
||||||
|
#include <Folders.h>
|
||||||
#include <StandardFile.h>
|
#include <StandardFile.h>
|
||||||
#include <Aliases.h>
|
#include <Aliases.h>
|
||||||
|
|
||||||
|
@ -567,6 +568,28 @@ mfs_GetDirectory(self, args)
|
||||||
return mkvalue("(Oi)", newmfssobject(&fsdir), ok);
|
return mkvalue("(Oi)", newmfssobject(&fsdir), ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static object *
|
||||||
|
mfs_FindFolder(self, args)
|
||||||
|
object *self; /* Not used */
|
||||||
|
object *args;
|
||||||
|
{
|
||||||
|
OSErr err;
|
||||||
|
short where;
|
||||||
|
OSType which;
|
||||||
|
int create;
|
||||||
|
short refnum;
|
||||||
|
long dirid;
|
||||||
|
|
||||||
|
if (!newgetargs(args, "hO&i", &where, PyMac_GetOSType, &which, &create) )
|
||||||
|
return NULL;
|
||||||
|
err = FindFolder(where, which, (Boolean)create, &refnum, &dirid);
|
||||||
|
if ( err ) {
|
||||||
|
PyErr_Mac(ErrorObject, err);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return mkvalue("(ii)", refnum, dirid);
|
||||||
|
}
|
||||||
|
|
||||||
/* List of methods defined in the module */
|
/* List of methods defined in the module */
|
||||||
|
|
||||||
static struct methodlist mfs_methods[] = {
|
static struct methodlist mfs_methods[] = {
|
||||||
|
@ -577,6 +600,7 @@ static struct methodlist mfs_methods[] = {
|
||||||
{"FSSpec", mfs_FSSpec, 1},
|
{"FSSpec", mfs_FSSpec, 1},
|
||||||
{"RawFSSpec", mfs_RawFSSpec, 1},
|
{"RawFSSpec", mfs_RawFSSpec, 1},
|
||||||
{"RawAlias", mfs_RawAlias, 1},
|
{"RawAlias", mfs_RawAlias, 1},
|
||||||
|
{"FindFolder", mfs_FindFolder, 1},
|
||||||
|
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue