From 66b70d6bd2d214f859ff18776655fa9961b26f91 Mon Sep 17 00:00:00 2001
From: Albert Graef <aggraef@gmail.com>
Date: Fri, 24 Mar 2017 09:22:54 +0100
Subject: [PATCH] Need to expand ~ et al when checking for the existence of
 search paths. Fixes #293.

---
 pd/src/s_file.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pd/src/s_file.c b/pd/src/s_file.c
index 7c54ee3bd..32034d04b 100644
--- a/pd/src/s_file.c
+++ b/pd/src/s_file.c
@@ -625,8 +625,14 @@ void sys_loadpreferences( void)
         sprintf(keybuf, "path%d", i+1);
         if (!sys_getpreference(keybuf, prefbuf, MAXPDSTRING))
             break;
-        else if (!check_exists(prefbuf)) // AG: ignore non-existent paths
-            continue;
+        else {
+            // AG: need to expand ~ et al here
+            char final_name[FILENAME_MAX];
+            sys_expandpathelems(prefbuf, final_name);
+            // AG: ignore non-existent paths
+            if (!check_exists(final_name))
+                continue;
+	}
         sys_searchpath = namelist_append_files(sys_searchpath, prefbuf);
     }
     if (sys_getpreference("standardpath", prefbuf, MAXPDSTRING))
-- 
GitLab