From c0c9a12d7d34fe1bc40f132913774fa72997f9ac Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Sun, 8 Jun 2014 15:04:08 -0400 Subject: [PATCH] *fixed bug where recent files did not construct a proper path+filename when invoking it from a command line (at startup) --- pd/src/s_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pd/src/s_main.c b/pd/src/s_main.c index ce1804624..32f04efab 100644 --- a/pd/src/s_main.c +++ b/pd/src/s_main.c @@ -169,11 +169,18 @@ static void openit(const char *dirname, const char *filename) glob_evalfile(0, gensym(nameptr), gensym(dirbuf)); sys_vgui("pdtk_set_current_dir %s\n", filename); //sys_vgui("::pd_menus::update_recentfiles_menu .mbar.file 0\n"); + if (strstr(filename, dirname) != NULL) { + // when opening files from a command line (at startup), filename contains full path + // so, if dirname is already included in filename we only pass filename variable + // otherwise combine the two and send them together #ifndef MSW - sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n", dirname, filename); + sys_vgui("::pd_guiprefs::update_recentfiles %s/%s 1\n", dirname, filename); #else - sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n", dirname, filename); + sys_vgui("::pd_guiprefs::update_recentfiles %s\%s 1\n", dirname, filename); #endif + } else { + sys_vgui("::pd_guiprefs::update_recentfiles %s 1\n", filename); + } } else error("%s: can't open", filename); -- GitLab