From b631c45c6afae1cc3962fee96c6a75074565febd Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon.(none)>
Date: Sat, 26 Jan 2013 12:59:36 -0500
Subject: [PATCH] ok, seriously, the final hard-coded fix for the pd~
 regression...

---
 pd/src/s_main.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 23318379e..80c22ff60 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -450,13 +450,18 @@ void sys_findprogdir(char *progname)
     strncpy(sbuf, progname, FILENAME_MAX);
     sbuf[FILENAME_MAX-1] = 0;
 #endif
-    lastslash = strrchr(sbuf, '/');
-    if (lastslash)
+#ifdef INSTALL_PREFIX
+    strcpy(sbuf2, INSTALL_PREFIX);
+#else
+    strcpy(sbuf2, ".");
+#endif
+    /*lastslash = strrchr(sbuf, '/');
+    if (!strcmp(sbuf2, "") && lastslash)
     {
-            /* bash last slash to zero so that sbuf is directory pd was in,
-                e.g., ~/pd/bin */
+            // bash last slash to zero so that sbuf is directory pd was in,
+            //    e.g., ~/pd/bin
         *lastslash = 0; 
-            /* go back to the parent from there, e.g., ~/pd */
+            // go back to the parent from there, e.g., ~/pd
         lastslash = strrchr(sbuf, '/');
         if (lastslash)
         {
@@ -464,16 +469,7 @@ void sys_findprogdir(char *progname)
             sbuf2[lastslash-sbuf] = 0;
         }
         else strcpy(sbuf2, "..");
-    }
-    else
-    {
-            /* no slashes found.  Try INSTALL_PREFIX. */
-#ifdef INSTALL_PREFIX
-        strcpy(sbuf2, INSTALL_PREFIX);
-#else
-        strcpy(sbuf2, ".");
-#endif
-    }
+    }*/
         /* now we believe sbuf2 holds the parent directory of the directory
         pd was found in.  We now want to infer the "lib" directory and the
         "gui" directory.  In "simple" unix installations, the layout is
-- 
GitLab