diff options
author | Robin Gareus <robin@gareus.org> | 2015-04-27 18:23:51 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-04-27 18:23:51 +0200 |
commit | 5291400878597a0bd3b1a70578c9edcbf5be21fe (patch) | |
tree | 6c9c165dd037691fa7c3f842e496383d282c2c1c /libs | |
parent | 7c09182d753ee1cc7c6fc95b0093c7046ccebe78 (diff) |
case insensitive VST plugin file extension - fixes #6285
2nd attempt.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/plugin_manager.cc | 3 | ||||
-rw-r--r-- | libs/ardour/vst_info_file.cc | 24 | ||||
-rw-r--r-- | libs/fst/scanner.cc | 14 |
3 files changed, 32 insertions, 9 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index e88541317c..37eb61ef3b 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -686,8 +686,7 @@ PluginManager::windows_vst_refresh (bool cache_only) static bool windows_vst_filter (const string& str, void * /*arg*/) { /* Not a dotfile, has a prefix before a period, suffix is "dll" */ - - return str[0] != '.' && (str.length() > 4 && str.find (".dll") == (str.length() - 4)); + return str[0] != '.' && str.length() > 4 && strings_equal_ignore_case (".dll", str.substr(str.length() - 4)); } int diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index 2d68421103..3b56876494 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -351,9 +351,15 @@ vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos) static bool vstfx_blacklist_stat (const char *dllpath, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { return true; } + string const path = vstfx_blacklist_path (dllpath, personal); if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) { @@ -435,7 +441,12 @@ vstfx_remove_infofile (const char *dllpath) static char * vstfx_infofile_stat (const char *dllpath, struct stat* statbuf, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { return 0; } @@ -494,8 +505,13 @@ vstfx_infofile_for_read (const char* dllpath) static FILE * vstfx_infofile_create (const char* dllpath, int personal) { - if (strstr (dllpath, ".so" ) == 0 && strstr(dllpath, ".dll") == 0) { - return 0; + const size_t slen = strlen (dllpath); + if ( + (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { + return NULL; } string const path = vstfx_infofile_path (dllpath, personal); diff --git a/libs/fst/scanner.cc b/libs/fst/scanner.cc index c7cbd897db..d56bdb168c 100644 --- a/libs/fst/scanner.cc +++ b/libs/fst/scanner.cc @@ -3,6 +3,8 @@ #include <string.h> #include <vector> +#include <glib.h> + #include "pbd/pbd.h" #include "pbd/transmitter.h" #include "pbd/receiver.h" @@ -75,7 +77,12 @@ int main (int argc, char **argv) { char *dllpath = NULL; if (argc == 3 && !strcmp("-f", argv[1])) { dllpath = argv[2]; - if (strstr (dllpath, ".so" ) || strstr(dllpath, ".dll")) { + const size_t slen = strlen (dllpath); + if ( + (slen > 3 && 0 == g_ascii_strcasecmp (&dllpath[slen-3], ".so")) + || + (slen > 4 && 0 == g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) + ) { vstfx_remove_infofile(dllpath); vstfx_un_blacklist(dllpath); } @@ -97,15 +104,16 @@ int main (int argc, char **argv) { std::vector<VSTInfo *> *infos = 0; + const size_t slen = strlen (dllpath); if (0) { } #ifdef LXVST_SUPPORT - else if (strstr (dllpath, ".so")) { + else if (slen > 3 && 0 == g_ascii_strcasecmp (&dllpath[slen-3], ".so")) { infos = vstfx_get_info_lx(dllpath); } #endif #ifdef WINDOWS_VST_SUPPORT - else if (strstr (dllpath, ".dll")) { + else if (slen > 4 && 0 == g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) { infos = vstfx_get_info_fst(dllpath); } #endif |