Commit 3cb11303 authored by Albert Gräf's avatar Albert Gräf
Browse files

Bugfix: patch files opened via the command line (-open) are now recorded in the recent files list.

parent 6af6311f
......@@ -947,11 +947,8 @@ exports.set_app_quitfn = function(quitfn) {
nw_app_quit = quitfn;
}
function open_file(file) {
var filename = defunkify_windows_path(file),
directory = path.dirname(filename),
basename = path.basename(filename),
cyclist;
function import_file(directory, basename)
{
if (basename.match(/\.(pat|mxb|help)$/) !=null) {
post("warning: opening pat|mxb|help not implemented yet");
if (pd_nt == 0) {
......@@ -976,9 +973,19 @@ function open_file(file) {
// puts stderr "converted Max binary to text format: $directory/$basename"
//}
}
}
function process_file(file, do_open) {
var filename = defunkify_windows_path(file),
directory = path.dirname(filename),
basename = path.basename(filename),
cyclist;
if (do_open) import_file(directory, basename);
if (basename.match(/\.(pd|pat|mxt)$/i) != null) {
pdsend("pd open", enquote(basename),
(enquote(directory)));
if (do_open) {
pdsend("pd open", enquote(basename),
(enquote(directory)));
}
set_pd_opendir(directory);
//::pd_guiprefs::update_recentfiles "$filename" 1
// update the recent files list
......@@ -987,6 +994,17 @@ function open_file(file) {
}
}
function open_file(file) {
process_file(file, 1);
}
function gui_process_open_arg(file) {
// AG: This is invoked when the engine opens a patch file via the command
// line (-open). In this case the file is already loaded, so we just
// update the opendir and the recent files list.
process_file(file, 0);
}
function open_html(target) {
nw_open_html(target);
}
......
......@@ -171,8 +171,7 @@ static void openit(const char *dirname, const char *filename)
{
close (fd);
glob_evalfile(0, gensym(nameptr), gensym(dirbuf));
gui_vmess("gui_set_current_dir", "xs",
0, filename);
gui_vmess("gui_process_open_arg", "s", 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