diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index e1bb15d75ceebfdc348b0547e5e8c3defc001c5f..0b41f8e65f51a6ab7106a07411e9c5844abc300c 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;