From 14a11419f8af431879bf5a6d457a41f05111a0a9 Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Wed, 23 Jan 2013 10:10:33 -0500 Subject: [PATCH] fixed pd~ external not finding the gui dir bug --- pd/src/s_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pd/src/s_main.c b/pd/src/s_main.c index 23318379e..8c9b52a2e 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -459,6 +459,14 @@ void sys_findprogdir(char *progname) /* go back to the parent from there, e.g., ~/pd */ lastslash = strrchr(sbuf, '/'); if (lastslash) + { + strncpy(sbuf2, sbuf, lastslash-sbuf); + sbuf2[lastslash-sbuf] = 0; + } + /* go back to the parent from there once more, e.g., ~/pd */ + strcpy(sbuf, sbuf2); + lastslash = strrchr(sbuf, '/'); + if (lastslash) { strncpy(sbuf2, sbuf, lastslash-sbuf); sbuf2[lastslash-sbuf] = 0; -- GitLab