Commit f79f7421 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

stop-gap to fix the opendir logic

parent 516eb31f
......@@ -40,7 +40,7 @@ exports.get_lib_dir = function() {
return lib_dir;
}
exports.get_pd_opendir = function() {
function get_pd_opendir() {
if (pd_opendir) {
return pd_opendir;
} else {
......@@ -48,6 +48,16 @@ exports.get_pd_opendir = function() {
}
}
exports.get_pd_opendir = get_pd_opendir;
function set_pd_opendir(dir) {
pd_opendir = dir;
}
function gui_set_current_dir(dummy, dir_and_filename) {
set_pd_opendir(path.dirname(dir_and_filename));
}
function gui_set_gui_preset(name) {
skin.set(name);
}
......@@ -543,7 +553,7 @@ exports.menu_saveas = menu_saveas;
function menu_new () {
// try not to use a global here
untitled_directory = pwd;
untitled_directory = get_pd_opendir();
pdsend("pd filename",
"Untitled-" + untitled_number,
enquote(defunkify_windows_path(untitled_directory)));
......@@ -764,7 +774,7 @@ function open_file(file) {
if (basename.match(/\.(pd|pat|mxt)$/i) != null) {
pdsend("pd open", enquote(basename),
(enquote(directory)));
pd_opendir = directory;
set_pd_opendir(directory);
//::pd_guiprefs::update_recentfiles "$filename" 1
}
}
......
......@@ -171,7 +171,9 @@ static void openit(const char *dirname, const char *filename)
{
close (fd);
glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
sys_vgui("pdtk_set_current_dir {%s}\n", filename);
//sys_vgui("pdtk_set_current_dir {%s}\n", filename);
gui_vmess("gui_set_current_dir", "xs",
0, filename);
}
else
error("%s: can't open", filename);
......
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