Commit 37756c8a authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix regression with the terrible and buggy nwworkingdir

parent b7483ba5
......@@ -937,12 +937,14 @@ function nw_create_patch_window_menus(gui, w, name) {
click: function() {
var input, chooser,
span = w.document.querySelector("#fileDialogSpan");
// Complicated workaround-- see comment in build_file_dialog_string
input = pdgui.build_file_dialog_string({
style: "display: none;",
type: "file",
id: "fileDialog",
nwworkingdir: "/user/home",
nwworkingdir: pdgui.get_pwd(),
multiple: null,
// These are copied from pd_filetypes in pdgui.js
accept: ".pd,.pat,.mxt,.mxb,.help"
});
span.innerHTML = input;
......
......@@ -409,6 +409,7 @@ function build_file_dialog_string(obj) {
exports.build_file_dialog_string = build_file_dialog_string;
function gui_canvas_saveas(name, initfile, initdir, close_flag) {
post("hey, the initdir is " + initdir + " and initfile is " + initfile);
var input, chooser,
span = patchwin[name].window.document.querySelector("#saveDialogSpan");
if (!fs.existsSync(initdir)) {
......@@ -423,8 +424,13 @@ function gui_canvas_saveas(name, initfile, initdir, close_flag) {
style: "display: none;",
type: "file",
id: "saveDialog",
nwsaveas: initdir + '/' + initfile,
nwworkingdir: initdir,
nwsaveas: initfile,
// For some reason we have to put the file name at the end of
// nwworkingdir path. Otherwise nw.js picks the final subdirectory as
// the suggested file name.
// nwworkingdir is by far the worst part of nw.js API-- if you run
// into a bug then be very suspicious of this code...
nwworkingdir: path.join(initdir, initfile),
accept: ".pd"
});
span.innerHTML = input;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment