From f45f244464b8e4818628c6c07efd69cba661d961 Mon Sep 17 00:00:00 2001 From: Albert Graef <aggraef@gmail.com> Date: Thu, 1 Aug 2019 21:00:57 +0200 Subject: [PATCH] Backport 'add-to-path' from vanilla rev. c917dd19, to make Gem happy. --- pd/src/m_glob.c | 3 +++ pd/src/s_path.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index b3ed14c9f..3efde149b 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -31,6 +31,7 @@ void glob_midi_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv); void glob_midi_setapi(t_pd *dummy, t_floatarg f); void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform); void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv); +void glob_addtopath(t_pd *dummy, t_symbol *path, t_float saveit); void glob_start_startup_dialog(t_pd *dummy, t_floatarg flongform); void glob_startup_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv); void glob_ping(t_pd *dummy); @@ -168,6 +169,8 @@ void glob_init(void) gensym("start-path-dialog"), 0); class_addmethod(glob_pdobject, (t_method)glob_path_dialog, gensym("path-dialog"), A_GIMME, 0); + class_addmethod(glob_pdobject, (t_method)glob_addtopath, + gensym("add-to-path"), A_SYMBOL, A_DEFFLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_start_startup_dialog, gensym("start-startup-dialog"), 0); class_addmethod(glob_pdobject, (t_method)glob_startup_dialog, diff --git a/pd/src/s_path.c b/pd/src/s_path.c index 321757a5b..e7ac2b1ec 100644 --- a/pd/src/s_path.c +++ b/pd/src/s_path.c @@ -802,6 +802,22 @@ void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) } } + /* AG 20190801: add one item to search path (backported from + vanilla rev. c917dd19, to make GEM happy). */ +void glob_addtopath(t_pd *dummy, t_symbol *path, t_float saveit) +{ + t_symbol *s = sys_decodedialog(path); + if (*s->s_name) + { + sys_searchpath = namelist_append_files(sys_searchpath, s->s_name); + if (saveit) { + /* AG: We just ignore this flag for now, later maybe save the + preferences here. GEM doesn't need this, and we don't use + Deken, so we can do without this. */ + } + } +} + /* start a startup dialog window */ void glob_start_startup_dialog(t_pd *dummy) { -- GitLab