VST cache rework (part one)

Don’t clutter up actual vst-plugin dirs with additional files.

Use dedicated folder for VST info-cache; use sha1-hash (of absolute dll
path) for .fsi file.

Use a single blacklist file (one path per line) instead of individual 
.fsb files per plugin.
This commit is contained in:
Robin Gareus
2015-08-03 00:25:19 +02:00
parent d9de55ae93
commit 8c45d446ad
4 changed files with 304 additions and 353 deletions

View File

@@ -32,11 +32,12 @@
# define VST_EXT_BLACKLIST ".fsb"
#endif
#define VST_EXT_ERRORFILE ".err"
# if ( defined(__x86_64__) || defined(_M_X64) )
#define VST_EXT_INFOFILE ".fsi64"
#define VST_BLACKLIST "vst64_blacklist.txt"
#else
#define VST_EXT_INFOFILE ".fsi"
#define VST_BLACKLIST "vst32_blacklist.txt"
#endif
#ifndef VST_SCANNER_APP
@@ -49,8 +50,6 @@ enum VSTScanMode {
VST_SCAN_INTERNAL
};
LIBARDOUR_API extern std::string get_personal_vst_info_cache_dir ();
LIBARDOUR_API extern std::string get_personal_vst_blacklist_dir ();
LIBARDOUR_API extern void vstfx_free_info_list (std::vector<VSTInfo *> *infos);
#ifdef LXVST_SUPPORT

View File

@@ -188,7 +188,7 @@ user_cache_directory ()
exit (1);
}
} else if (!Glib::file_test (p, Glib::FILE_TEST_IS_DIR)) {
error << string_compose (_("Cache directory %1 already exists and is not a directory/folder - cannot run"),
fatal << string_compose (_("Cache directory %1 already exists and is not a directory/folder - cannot run"),
p) << endmsg;
exit (1);
}

View File

@@ -292,7 +292,7 @@ PluginManager::cancel_plugin_timeout ()
void
PluginManager::clear_vst_cache ()
{
// see also libs/ardour/vst_info_file.cc - vstfx_infofile_path()
#if 1 // clean old cache and error files. (remove this code after 4.3 or 5.0)
#ifdef WINDOWS_VST_SUPPORT
{
vector<string> fsi_files;
@@ -301,6 +301,20 @@ PluginManager::clear_vst_cache ()
::g_unlink(i->c_str());
}
}
{
vector<string> fsi_files;
find_files_matching_regex (fsi_files, Config->get_plugin_path_vst(), "\\.fsi$", true);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
}
}
{
vector<string> fsi_files;
find_files_matching_regex (fsi_files, Config->get_plugin_path_vst(), "\\.err$", true);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
}
}
#endif
#ifdef LXVST_SUPPORT
@@ -311,13 +325,28 @@ PluginManager::clear_vst_cache ()
::g_unlink(i->c_str());
}
}
{
vector<string> fsi_files;
find_files_matching_regex (fsi_files, Config->get_plugin_path_lxvst(), "\\.fsi$", true);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
}
}
{
vector<string> fsi_files;
find_files_matching_regex (fsi_files, Config->get_plugin_path_lxvst(), "\\.err$", true);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
}
}
#endif
#endif // old cache cleanup
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
{
string personal = get_personal_vst_info_cache_dir();
string dn = Glib::build_filename (ARDOUR::user_cache_directory(), "vst");
vector<string> fsi_files;
find_files_matching_regex (fsi_files, personal, "\\" VST_EXT_INFOFILE "$", /* user cache is flat, no recursion */ false);
find_files_matching_regex (fsi_files, dn, "\\" VST_EXT_INFOFILE "$", /* user cache is flat, no recursion */ false);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
}
@@ -328,6 +357,8 @@ PluginManager::clear_vst_cache ()
void
PluginManager::clear_vst_blacklist ()
{
#if 1 // remove old blacklist files. (remove this code after 4.3 or 5.0)
#ifdef WINDOWS_VST_SUPPORT
{
vector<string> fsi_files;
@@ -348,17 +379,17 @@ PluginManager::clear_vst_blacklist ()
}
#endif
#endif // old blacklist cleanup
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
{
string personal = get_personal_vst_blacklist_dir();
vector<string> fsi_files;
find_files_matching_regex (fsi_files, personal, "\\" VST_EXT_BLACKLIST "$", /* flat user cache */ false);
for (vector<string>::iterator i = fsi_files.begin(); i != fsi_files.end (); ++i) {
::g_unlink(i->c_str());
string fn = Glib::build_filename (ARDOUR::user_cache_directory(), VST_BLACKLIST);
if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
::g_unlink (fn.c_str());
}
}
#endif
}
void
@@ -797,7 +828,7 @@ PluginManager::windows_vst_discover (string path, bool cache_only)
_windows_vst_plugin_info->push_back (info);
discovered++;
if (Config->get_verbose_plugin_scan()) {
PBD::info << string_compose (_(" -> OK. (VST Plugin \"%1\" added)."), info->name) << endmsg;
PBD::info << string_compose (_(" -> OK. (VST Plugin \"%1\" added)."), info->name) << endmsg;
}
}
}

File diff suppressed because it is too large Load Diff