Remove false-positive VST log message
Ardour prevents repeat crashes by first marking a plugin as blacklisted, and after a successful scan the plugin is whitelisted. When not scanning for plugins, but reading the cache and successfully parsing the cashed content, a VST2 plugin is whitelisted, even though it may not have been blacklisted. In case the blacklist is empty, this lead to a logging: "Expected VST Blacklist file does not exist." PS. This also consolidates VST2 + VST3 code for white/blacklist
This commit is contained in:
parent
bc61ff74ad
commit
d6e4e0fb35
|
@ -1420,15 +1420,33 @@ PluginManager::au_refresh (bool cache_only)
|
|||
|
||||
#if (defined WINDOWS_VST_SUPPORT || defined MACVST_SUPPORT || defined LXVST_SUPPORT)
|
||||
|
||||
static bool vst2_is_blacklisted (string const& module_path)
|
||||
{
|
||||
string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST2_BLACKLIST);
|
||||
if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string bl;
|
||||
try {
|
||||
bl = Glib::file_get_contents (fn);
|
||||
} catch (Glib::FileError const& err) {
|
||||
return false;
|
||||
}
|
||||
return bl.find (module_path + "\n") != string::npos;
|
||||
}
|
||||
|
||||
static void vst2_blacklist (string const& module_path)
|
||||
{
|
||||
if (module_path.empty () || vst2_is_blacklisted (module_path)) {
|
||||
return;
|
||||
}
|
||||
string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST2_BLACKLIST);
|
||||
FILE* f = NULL;
|
||||
if (! (f = g_fopen (fn.c_str (), "a"))) {
|
||||
PBD::error << string_compose (_("Cannot write to VST2 blacklist file '%1'"), fn) << endmsg;
|
||||
return;
|
||||
}
|
||||
assert (NULL == strchr (module_path.c_str(), '\n'));
|
||||
fprintf (f, "%s\n", module_path.c_str ());
|
||||
::fclose (f);
|
||||
}
|
||||
|
@ -1437,7 +1455,6 @@ static void vst2_whitelist (string module_path)
|
|||
{
|
||||
string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST2_BLACKLIST);
|
||||
if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
|
||||
PBD::warning << _("Expected VST Blacklist file does not exist.") << endmsg;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1460,22 +1477,6 @@ static void vst2_whitelist (string module_path)
|
|||
Glib::file_set_contents (fn, bl);
|
||||
}
|
||||
|
||||
static bool vst2_is_blacklisted (string const& module_path)
|
||||
{
|
||||
string fn = Glib::build_filename (ARDOUR::user_cache_directory (), VST2_BLACKLIST);
|
||||
if (!Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string bl;
|
||||
try {
|
||||
bl = Glib::file_get_contents (fn);
|
||||
} catch (Glib::FileError const& err) {
|
||||
return false;
|
||||
}
|
||||
return bl.find (module_path + "\n") != string::npos;
|
||||
}
|
||||
|
||||
static void vst2_scanner_log (std::string msg, std::stringstream* ss)
|
||||
{
|
||||
*ss << msg;
|
||||
|
@ -1702,17 +1703,13 @@ PluginManager::vst2_discover (string path, ARDOUR::PluginType type, bool cache_o
|
|||
if (!tree.root()->get_property ("binary", binary) || binary != path) {
|
||||
psle->msg (PluginScanLogEntry::Incompatible, string_compose (_("Invalid VST2 cache file '%1'"), cache_file)); // XXX log as error msg
|
||||
psle->msg (PluginScanLogEntry::Blacklisted);
|
||||
if (!vst2_is_blacklisted (path)) {
|
||||
vst2_blacklist (path);
|
||||
}
|
||||
vst2_blacklist (path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string arch;
|
||||
if (!tree.root()->get_property ("arch", arch) || arch != vst2_arch ()) {
|
||||
if (!vst2_is_blacklisted (path)) {
|
||||
vst2_blacklist (path);
|
||||
}
|
||||
vst2_blacklist (path);
|
||||
psle->msg (PluginScanLogEntry::Blacklisted);
|
||||
psle->msg (PluginScanLogEntry::Incompatible, string_compose (_("VST2 architecture mismatches '%1'"), arch));
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user