From c67822debeb5d509ca6a8bab68cd724c4e0a2bb5 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sun, 25 Sep 2016 21:33:56 -0400
Subject: [PATCH] Fix gui_dir location for OSX so that the doc files are found
 (load meter, etc.)

---
 pd/nw/index.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pd/nw/index.js b/pd/nw/index.js
index 8cc5832eb..c2fed7241 100644
--- a/pd/nw/index.js
+++ b/pd/nw/index.js
@@ -37,7 +37,11 @@ function set_vars(win) {
         // If we're starting Pd, this is the first port number to try. (We'll
         // increment it if that port happens to be taken.
         port_no = 5400;
-        gui_dir = pwd;
+        // This is confusing and needs to be rethought. OSX app bundle needs
+        // the gui_dir to be "bin", but the actual gui files reside in
+        // "bin/../" because of the structure of the nw.js app bundle we use.
+        // Anyway, this seems to get all the "doc" links to be found...
+        gui_dir = process.platform === "darwin" ? "bin" : pwd;
     }
     pdgui.set_port(port_no);
     pdgui.set_pwd(pwd);
-- 
GitLab