From 2ad6afbbf89aaf4eb8c0626e5a5b71819a9407fe Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 2 Feb 2017 17:01:49 -0500
Subject: [PATCH] Try to fix #222: for OSX App bundle, start pwd in the user's
 directory instead of deep inside the App bundle

---
 pd/nw/pdgui.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index 82c3ca2ce..6e340c9ef 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -1052,7 +1052,18 @@ function external_doc_open(url) {
 exports.external_doc_open = external_doc_open;
 
 function gui_set_cwd(dummy, cwd) {
-    if (cwd !== ".") {
+    // The check for "darwin" is a quick workaround for getting
+    // the OSX App bundle to start the pwd in the user's working directory
+    // instead of deep inside the App bundle itself.  However, this may
+    // become a problem when people try to install Purr Data "Linux"-style,
+    // that is, install it system-wide from the command line instead of
+    // in an App bundle.
+
+    // Also, there is a general problem that we're setting the pwd from
+    // two different places-- index.js in set_vars() and s_inter.c with
+    // this call.  That's unnecessarily complex and hard to follow. It
+    // should be simplified
+    if (cwd !== "." && process.platform !== "darwin") {
         pwd = cwd;
     }
 }
-- 
GitLab