#include <sys/types.h>
#include <cstdio>
#include <cstdlib>
-#include <fstream>
+
+#include <glib.h>
+#include "pbd/gstdio_compat.h"
#ifdef HAVE_LRDF
#include <lrdf.h>
#include <cstring>
#endif //LXVST_SUPPORT
-#include <glib/gstdio.h>
#include <glibmm/miscutils.h>
#include <glibmm/pattern.h>
#include <glibmm/fileutils.h>
#ifdef PLATFORM_WINDOWS
// on windows the .exe needs to be in the same folder with libardour.dll
- vstsp += Glib::build_filename(g_win32_get_package_installation_directory_of_module (0), "bin");
+ vstsp += Glib::build_filename(windows_package_directory_path(), "bin");
#else
// on Unices additional internal-use binaries are deployed to $libdir
vstsp += ARDOUR::ardour_dll_directory();
void
PluginManager::refresh (bool cache_only)
{
+ Glib::Threads::Mutex::Lock lm (_lock, Glib::Threads::TRY_LOCK);
+
+ if (!lm.locked()) {
+ return;
+ }
+
DEBUG_TRACE (DEBUG::PluginManager, "PluginManager::refresh\n");
_cancel_scan = false;
#endif
#ifdef WINDOWS_VST_SUPPORT
if (Config->get_use_windows_vst()) {
- BootMessage (_("Scanning Windows VST Plugins"));
+ if (cache_only) {
+ BootMessage (_("Scanning Windows VST Plugins"));
+ } else {
+ BootMessage (_("Discovering Windows VST Plugins"));
+ }
windows_vst_refresh (cache_only);
}
#endif // WINDOWS_VST_SUPPORT
#ifdef LXVST_SUPPORT
if(Config->get_use_lxvst()) {
- BootMessage (_("Scanning Linux VST Plugins"));
+ if (cache_only) {
+ BootMessage (_("Scanning Linux VST Plugins"));
+ } else {
+ BootMessage (_("Discovering Linux VST Plugins"));
+ }
lxvst_refresh(cache_only);
}
#endif //Native linuxVST SUPPORT
+#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
+ if (!cache_only) {
+ string fn = Glib::build_filename (ARDOUR::user_cache_directory(), VST_BLACKLIST);
+ if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
+ gchar *bl = NULL;
+ if (g_file_get_contents(fn.c_str (), &bl, NULL, NULL)) {
+ PBD::info << _("VST Blacklist:") << "\n" << bl << "-----" << endmsg;
+ g_free (bl);
+ }
+ }
+ }
+#endif
+
#ifdef AUDIOUNIT_SUPPORT
- BootMessage (_("Scanning AU Plugins"));
+ if (cache_only) {
+ BootMessage (_("Scanning AU Plugins"));
+ } else {
+ BootMessage (_("Discovering AU Plugins"));
+ }
au_refresh (cache_only);
#endif
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;
+ find_files_matching_regex (fsi_files, Config->get_plugin_path_vst(), "\\" VST_EXT_INFOFILE "$", 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(), "\\.fsi$", true);
::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
+ {
+ vector<string> fsi_files;
+ find_files_matching_regex (fsi_files, Config->get_plugin_path_lxvst(), "\\" VST_EXT_INFOFILE "$", 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(), "\\.fsi$", true);
::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
+#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
+ {
+ string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_info");
+ if (Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
+ PBD::remove_directory (dir);
+ }
+ }
+#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, "\\.fsi$", /* 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());
}
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;
}
}
#endif
-
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
{
- string personal = get_personal_vst_blacklist_dir();
+ string dir = Glib::build_filename (ARDOUR::user_cache_directory(), "fst_blacklist");
+ if (Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
+ PBD::remove_directory (dir);
+ }
+ }
+#endif
- 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());
+#endif // old blacklist cleanup
+
+#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT)
+ {
+ 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
_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\" was added)."), info->name) << endmsg;
}
}
}
void
PluginManager::save_statuses ()
{
- ofstream ofs;
std::string path = Glib::build_filename (user_config_directory(), "plugin_statuses");
-
- ofs.open (path.c_str(), ios_base::openmode (ios::out|ios::trunc));
-
- if (!ofs) {
- return;
- }
+ stringstream ofs;
for (PluginStatusList::iterator i = statuses.begin(); i != statuses.end(); ++i) {
switch ((*i).type) {
ofs << (*i).unique_id;;
ofs << endl;
}
-
- ofs.close ();
+ g_file_set_contents (path.c_str(), ofs.str().c_str(), -1, NULL);
}
void
PluginManager::load_statuses ()
{
std::string path = Glib::build_filename (user_config_directory(), "plugin_statuses");
- ifstream ifs (path.c_str());
-
- if (!ifs) {
+ gchar *fbuf = NULL;
+ if (!g_file_get_contents (path.c_str(), &fbuf, NULL, NULL)) {
return;
}
+ stringstream ifs (fbuf);
+ g_free (fbuf);
std::string stype;
std::string sstatus;
strip_whitespace_edges (id);
set_status (type, id, status);
}
-
- ifs.close ();
}
void