Set the default directory to somewhere useful (the PuTTY saved sessions
[sgt/putty] / mac / mac.c
index 779792f..deb083a 100644 (file)
--- a/mac/mac.c
+++ b/mac/mac.c
@@ -1,4 +1,4 @@
-/* $Id: mac.c,v 1.7 2002/12/13 00:02:48 ben Exp $ */
+/* $Id: mac.c,v 1.11 2002/12/30 19:01:44 ben Exp $ */
 /*
  * Copyright (c) 1999 Ben Harris
  * All rights reserved.
@@ -40,6 +40,7 @@
 #include <Devices.h>
 #include <DiskInit.h>
 #include <Gestalt.h>
+#include <LowMem.h>
 #include <Resources.h>
 #include <Script.h>
 #include <TextCommon.h>
@@ -174,6 +175,17 @@ static void mac_startup(void) {
     windows.about = NULL;
     windows.licence = NULL;
 
+    {
+       short vol;
+       long dirid;
+
+       /* Set the default directory for loading and saving settings. */
+       /* XXX Should we create it? */
+       if (get_session_dir(FALSE, &vol, &dirid) == noErr) {
+           LMSetSFSaveDisk(-vol);
+           LMSetCurDirStore(dirid);
+       }
+    }
     init_ucs();
 }
 
@@ -413,6 +425,9 @@ static void mac_menucommand(long result) {
           case iNew:
             mac_newsession();
             goto done;
+         case iOpen:
+           mac_opensession();
+           goto done;
           case iClose:
             mac_closewindow(window);
             goto done;
@@ -456,11 +471,6 @@ static void mac_openabout(void) {
 }
 
 static void mac_openlicence(void) {
-    DialogItemType itemtype;
-    Handle item;
-    VersRecHndl vers;
-    Rect box;
-    StringPtr longvers;
 
     if (windows.licence)
        SelectWindow(windows.licence);
@@ -564,8 +574,10 @@ static void mac_adjustcursor(RgnHandle cursrgn) {
 
 static void mac_shutdown(void) {
 
+#if !TARGET_RT_MAC_CFM
     if (mac_gestalts.encvvers != 0)
        TerminateUnicodeConverter();
+#endif
     exit(0);
 }