case insensitive VST plugin file extension - fixes #6285

2nd attempt.
This commit is contained in:
Robin Gareus
2015-04-27 18:23:51 +02:00
parent 7c09182d75
commit 5291400878
3 changed files with 32 additions and 9 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -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