aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-12 23:20:21 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-12 23:20:21 +0000
commit7da3d638c0e4e2b9df7c66a153b535041a6d9786 (patch)
treea08bfe714a9650374108af4084aac02292c3e5f5
parent9b28888c708ba578080c3c25c72d4c35fda760e5 (diff)
patch #1962700 two embedded prefs for Mac: default and override all
svn path=/trunk/; revision=9793
-rw-r--r--packages/patches/default_and_embedded_plist-0.41.4.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/patches/default_and_embedded_plist-0.41.4.patch b/packages/patches/default_and_embedded_plist-0.41.4.patch
new file mode 100644
index 00000000..c5c7119c
--- /dev/null
+++ b/packages/patches/default_and_embedded_plist-0.41.4.patch
@@ -0,0 +1,50 @@
+Index: s_file.c
+===================================================================
+--- s_file.c (revision 9789)
++++ s_file.c (working copy)
+@@ -235,17 +235,35 @@
+ {
+ char cmdbuf[256];
+ int nread = 0, nleft = size;
+- char embedded_prefs[MAXPDSTRING];
+- char user_prefs[MAXPDSTRING];
+- char *homedir = getenv("HOME");
++ char default_prefs[MAXPDSTRING]; // default prefs embedded in the package
++ char embedded_prefs[MAXPDSTRING]; // overrides others for standalone app
++ char embedded_prefs_file[MAXPDSTRING];
++ char user_prefs_file[MAXPDSTRING];
++ char *homedir = getenv("HOME");
+ struct stat statbuf;
+- /* the 'defaults' command expects the filename without .plist at the end */
+- snprintf(embedded_prefs, MAXPDSTRING, "%s/../org.puredata.pd", sys_libdir->s_name);
+- snprintf(user_prefs, MAXPDSTRING, "%s/Library/Preferences/org.puredata.pd.plist", homedir);
+- if (stat(user_prefs, &statbuf) == 0)
+- snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n", key);
+- else
+- snprintf(cmdbuf, 256, "defaults read %s %s 2> /dev/null\n", embedded_prefs, key);
++ /* the 'defaults' command expects the filename without .plist at the end */
++ snprintf(default_prefs, MAXPDSTRING, "%s/../org.puredata.pd.default",
++ sys_libdir->s_name);
++ snprintf(embedded_prefs, MAXPDSTRING, "%s/../org.puredata.pd",
++ sys_libdir->s_name);
++ snprintf(embedded_prefs_file, MAXPDSTRING, "%s.plist", embedded_prefs);
++ snprintf(user_prefs_file, MAXPDSTRING,
++ "%s/Library/Preferences/org.puredata.pd.plist", homedir);
++ if (stat(embedded_prefs_file, &statbuf) == 0)
++ {
++ snprintf(cmdbuf, 256,
++ "defaults read %s %s 2> /dev/null\n", embedded_prefs, key);
++ }
++ else if (stat(user_prefs_file, &statbuf) == 0)
++ {
++ snprintf(cmdbuf, 256,
++ "defaults read org.puredata.pd %s 2> /dev/null\n", key);
++ }
++ else
++ {
++ snprintf(cmdbuf, 256,
++ "defaults read %s %s 2> /dev/null\n", default_prefs, key);
++ }
+ FILE *fp = popen(cmdbuf, "r");
+ while (nread < size)
+ {