From 51433563764e84fdb69dcfeef0f1700afe734c03 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 3 May 2016 17:18:54 -0400
Subject: [PATCH] fix jwilkes/purr-data#65 normalize Windows path before
 sending it to Pd

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

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index e1bb15d75..0b41f8e65 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -14,7 +14,11 @@ exports.get_pwd = function() {
 }
 
 function defunkify_windows_path(s) {
-    return s.replace(/\\/g, "/");
+    var ret = s;
+    if (process.platform === "win32") {
+        ret = ret.replace(/\\/g, "/");
+    }
+    return ret;
 }
 
 exports.defunkify_windows_path = defunkify_windows_path;
@@ -487,7 +491,7 @@ function menu_new () {
     untitled_directory = pwd;
     pdsend("pd filename",
            "Untitled-" + untitled_number,
-           enquote(untitled_directory));
+           enquote(defunkify_windows_path(untitled_directory)));
     // I don't think k12_mode works yet. Need to test this.
     if (k12_mode == 1) {
         k12_saveas_on_new = 1;
-- 
GitLab