From 172b4e5eaa85970b7b8daa515d480fd7ae9932e2 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sun, 3 Apr 2016 23:47:16 -0400
Subject: [PATCH] another attempt to correct for windows backslashes in
 filenames

---
 pd/nw/pdgui.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index ab6de6cfb..a4e4826da 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -694,7 +694,8 @@ function open_file(file) {
         //}
     }
     if (basename.match(/\.(pd|pat|mxt)$/i) != null) {
-        pdsend("pd open", enquote(basename), enquote(directory));
+        pdsend("pd open", enquote(basename),
+            defunkify_for_windows(enquote(directory)));
         pd_opendir = directory;
         //::pd_guiprefs::update_recentfiles "$filename" 1
     }
@@ -725,6 +726,7 @@ function open_textfile(target) {
 
 // Open a file-- html, text, or Pd.
 function doc_open (dir, basename) {
+    // normalize to get rid of extra slashes, ".." and "."
     var norm_path = path.normalize(dir);
     if (basename.slice(-4) === ".txt"
         || basename.slice(-2) === ".c") {
@@ -735,7 +737,8 @@ function doc_open (dir, basename) {
         open_html(path.join(norm_path, basename));
 
     } else {
-        pdsend("pd open", enquote(basename), enquote(norm_path));
+        pdsend("pd open", enquote(basename),
+            defunkify_for_windows(enquote(norm_path)));
     }
 }
 
-- 
GitLab