From a702174273e2e04eda32f0e8cbb0a467ea28ca8f Mon Sep 17 00:00:00 2001
From: Leo Singer <leo.singer@ligo.org>
Date: Mon, 18 Nov 2019 15:07:35 -0500
Subject: [PATCH 1/4] Use MacPorts share directory instead of zipfs

---
 ds9/library/ds9.tcl |  2 +-
 ds9/unix/ds9.C      | 22 +++-------------------
 2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl
index 8e543dcd..b381c404 100644
--- a/ds9/library/ds9.tcl
+++ b/ds9/library/ds9.tcl
@@ -175,7 +175,7 @@ set ds9(app) [file tail [info nameofexecutable]]
 # pre package load
 switch $ds9(wm) {
     x11 {
-	set ds9(root) "[::tcl::zipfs::root]mntpt"
+	set ds9(root) "@macports_prefix@/share/ds9"
 	set auto_path [list $ds9(root) $ds9(root)/tcl8.6 $ds9(root)/tk8.6 $ds9(root)/tk8.6/ttk]
     }
     aqua {
diff --git a/ds9/unix/ds9.C b/ds9/unix/ds9.C
index 6642cecc..d3018c50 100644
--- a/ds9/unix/ds9.C
+++ b/ds9/unix/ds9.C
@@ -60,11 +60,11 @@ int SAOLocalMainHook(int* argcPtr, char*** argvPtr)
 
   // so that tcl and tk know where to find their libs
   // we do it here before InitLibraryPath is called
-  putenv((char*)"TCL_LIBRARY=zipfs:/mntpt/tcl8.6");
-  putenv((char*)"TK_LIBRARY=zipfs:/mntpt/tk8.6");
+  putenv((char*)"TCL_LIBRARY=@macports_prefix@/share/ds9/tcl8.6");
+  putenv((char*)"TK_LIBRARY=@macports_prefix@/share/ds9/tcl8.6");
 
   // startup script
-  Tcl_Obj *path = Tcl_NewStringObj("zipfs:/mntpt/library/ds9.tcl",-1);
+  Tcl_Obj *path = Tcl_NewStringObj("@macports_prefix@/share/ds9/library/ds9.tcl",-1);
   Tcl_SetStartupScript(path, NULL);
 
   return TCL_OK;
@@ -84,22 +84,6 @@ int SAOAppInit(Tcl_Interp *interp)
   Tcl_StaticPackage (interp, "zipfs", TclZipfs_Init,
 		     (Tcl_PackageInitProc*)NULL);
 
-  // find current working directory, and set as mount point
-  {
-#ifdef ZIPFILE
-    ostringstream str;
-    str << (char *)Tcl_GetNameOfExecutable() 
-	<< ".zip" 
-	<<  ends;
-    if(TclZipfs_Mount(interp, "", (const char*)str.str().c_str(), NULL) != TCL_OK ){
-      cerr << "ERROR: Unable to open the auxiliary ds9 file 'ds9.zip'. If you moved the ds9 program from its original location, please also move the zip file to the same place." << endl;
-      exit(1);
-    }
-#else
-    TclZipfs_Mount(interp, "", (const char *)Tcl_GetNameOfExecutable(), NULL);
-#endif
-  }
-
   // Tcl
   if (Tcl_Init(interp) == TCL_ERROR)
     return TCL_ERROR;
-- 
2.24.0

