From d5d5f462f9a8ff6f2d0e982c3c7f3fff3b683dcf Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Mon, 14 Aug 1995 12:22:56 +0000 Subject: Added new call PromptGetFile (like StandardGetFile, but accepts a prompt) and added optional prompt to GetDirectory. --- Mac/Modules/macfsmodule.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 03580b0..4d41f25 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -652,6 +652,31 @@ mfs_StandardGetFile(self, args) } static object * +mfs_PromptGetFile(self, args) + object *self; /* Not used */ + object *args; +{ + SFTypeList list; + short numtypes; + StandardFileReply reply; + char *prompt = NULL; + + list[0] = list[1] = list[2] = list[3] = 0; + numtypes = 0; + if (!newgetargs(args, "s|O&O&O&O&", &prompt, PyMac_GetOSType, &list[0], + PyMac_GetOSType, &list[1], PyMac_GetOSType, &list[2], + PyMac_GetOSType, &list[3]) ) + return NULL; + while ( numtypes < 4 && list[numtypes] ) { + numtypes++; + } + if ( numtypes == 0 ) + numtypes = -1; + PyMac_PromptGetFile(numtypes, list, &reply, prompt); + return mkvalue("(Oi)", newmfssobject(&reply.sfFile), reply.sfGood); +} + +static object * mfs_StandardPutFile(self, args) object *self; /* Not used */ object *args; @@ -724,11 +749,12 @@ mfs_GetDirectory(self, args) { FSSpec fsdir; int ok; + char *prompt = NULL; - if (!newgetargs(args, "") ) + if (!newgetargs(args, "|s", &prompt) ) return NULL; - ok = PyMac_GetDirectory(&fsdir); + ok = PyMac_GetDirectory(&fsdir, prompt); return mkvalue("(Oi)", newmfssobject(&fsdir), ok); } @@ -767,6 +793,7 @@ mfs_FInfo(self, args) static struct methodlist mfs_methods[] = { {"ResolveAliasFile", mfs_ResolveAliasFile, 1}, {"StandardGetFile", mfs_StandardGetFile, 1}, + {"PromptGetFile", mfs_PromptGetFile, 1}, {"StandardPutFile", mfs_StandardPutFile, 1}, {"GetDirectory", mfs_GetDirectory, 1}, {"FSSpec", mfs_FSSpec, 1}, -- cgit v0.12