summaryrefslogtreecommitdiffstats
path: root/Mac/Python/macglue.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-03-06 16:21:34 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-03-06 16:21:34 (GMT)
commit378815ca860871b4cfeed65ce31e0099fdb6c92c (patch)
tree05aca10edfea68369e6ac22d8d926019b0389d41 /Mac/Python/macglue.c
parent7275561d34c6a8565caf512ee3b647f200ca3155 (diff)
downloadcpython-378815ca860871b4cfeed65ce31e0099fdb6c92c.zip
cpython-378815ca860871b4cfeed65ce31e0099fdb6c92c.tar.gz
cpython-378815ca860871b4cfeed65ce31e0099fdb6c92c.tar.bz2
Replaced previous gusi-chdir() fix by a call to PyMac_FixGUSIcd()
after each chdir call.
Diffstat (limited to 'Mac/Python/macglue.c')
-rw-r--r--Mac/Python/macglue.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index dd4499e..215accc 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -51,6 +51,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef USE_GUSI
#include <TFileSpec.h> /* For Path2FSSpec */
+#include <LowMem.h> /* For SetSFCurDir, etc */
#endif
#ifndef HAVE_UNIVERSAL_HEADERS
@@ -118,6 +119,34 @@ struct hook_args {
static DlgHookYDUPP myhook_upp;
static int upp_inited = 0;
+#ifdef USE_GUSI
+/*
+** GUSI (1.6.0 and earlier, at the least) do not set the MacOS idea of
+** the working directory. Hence, we call this routine after each call
+** to chdir() to rectify things.
+*/
+void
+PyMac_FixGUSIcd()
+{
+ WDPBRec pb;
+ FSSpec curdirfss;
+
+ if ( Path2FSSpec(":x", &curdirfss) != noErr )
+ return;
+
+ /* Set MacOS "working directory" */
+ pb.ioNamePtr= "\p";
+ pb.ioVRefNum= curdirfss.vRefNum;
+ pb.ioWDDirID= curdirfss.parID;
+ if (PBHSetVol(&pb, 0) != noErr)
+ return;
+
+ /* Set standard-file working directory */
+ LMSetSFSaveDisk(-curdirfss.vRefNum);
+ LMSetCurDirStore(curdirfss.parID);
+}
+#endif
+
/* Convert C to Pascal string. Returns pointer to static buffer. */
unsigned char *
@@ -657,21 +686,8 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *fs)
/* It's a pathname */
if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
return 0;
-#ifdef USE_GUSI
- {
- FSSpec curdirfss;
-
- if ( Path2FSSpec(":x", &curdirfss) == 0 ) {
- refnum = curdirfss.vRefNum;
- parid = curdirfss.parID;
- } else {
- return 0;
- }
- }
-#else
- refnum = 0; /* XXXX Should get CurWD here... */
+ refnum = 0; /* XXXX Should get CurWD here?? */
parid = 0;
-#endif
} else {
if( !PyArg_Parse(v, "(hlO&); FSSpec should be fullpath or (vrefnum,dirid,path)",
&refnum, &parid, PyMac_GetStr255, &path)) {
@@ -687,7 +703,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *fs)
}
-
/* Convert a Python object to a Rect.
The object must be a (left, top, right, bottom) tuple.
(This differs from the order in the struct but is consistent with