From fcf91e51c008681f26c48b9a51a0475b509abe2c Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 21 Dec 2023 17:12:13 +0100 Subject: [PATCH] Fix "Fl_Plugin_Manager::loadAll doesn't work correct" (#876) --- src/Fl_Preferences.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index f4a769d69..43ffa57fc 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -1981,12 +1981,14 @@ int Fl_Plugin_Manager::load(const char *filename) { \brief Use this function to load a whole directory full of modules. */ int Fl_Plugin_Manager::loadAll(const char *filepath, const char *pattern) { + if (!filepath || strlen(filepath) < 1) return -1; + const char *format = (filepath[strlen(filepath) - 1] == '/' ? "%s%s" : "%s/%s"); struct dirent **dir; int i, n = fl_filename_list(filepath, &dir); for (i=0; id_name, pattern)) { - load(Fl_Preferences::Name("%s%s", filepath, e->d_name)); + load(Fl_Preferences::Name(format, filepath, e->d_name)); } free(e); }