diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-22 09:16:48 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-22 09:16:48 +0100 |
| commit | f59702e290be9ededeeae9f0e78b422cf359de3f (patch) | |
| tree | 1f952391911e699e1dc9bd25410aea0db5c05cb8 /src/Fl_Preferences.cxx | |
| parent | 007e37d8973c543004a41ff1d7385b0cfd6ffd4c (diff) | |
A more cross-platform way to fix issue #876
Diffstat (limited to 'src/Fl_Preferences.cxx')
| -rw-r--r-- | src/Fl_Preferences.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index 43ffa57fc..bce0471f8 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -1978,17 +1978,19 @@ int Fl_Plugin_Manager::load(const char *filename) { } /** - \brief Use this function to load a whole directory full of modules. + Use this function to load a whole directory full of modules. + \param dirpath Pathname of a directory. It \b must end with the platform's directory separator character + (i.e., '\\' under Windows, '/' otherwise). + \param pattern A filename pattern to catch all modules of interest in the targeted directory + (e.g., "{*.so,*.dll,*.dylib}"), or NULL to catch all files in the directory. */ -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"); +int Fl_Plugin_Manager::loadAll(const char *dirpath, const char *pattern) { struct dirent **dir; - int i, n = fl_filename_list(filepath, &dir); + int i, n = fl_filename_list(dirpath, &dir); for (i=0; i<n; i++) { struct dirent *e = dir[i]; if (pattern==0 || fl_filename_match(e->d_name, pattern)) { - load(Fl_Preferences::Name(format, filepath, e->d_name)); + load(Fl_Preferences::Name("%s%s", dirpath, e->d_name)); } free(e); } |
