X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fpanner_manager.cc;h=c6b73b40775fbdac0ce8d58bd9ed723d600b0573;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=0084a62285a8ddc981b6e08cd33d290bc81abd4e;hpb=2ba58dfe65bb0c5ba7d5eb18a1566fa79eeb6993;p=ardour.git diff --git a/libs/ardour/panner_manager.cc b/libs/ardour/panner_manager.cc index 0084a62285..c6b73b4077 100644 --- a/libs/ardour/panner_manager.cc +++ b/libs/ardour/panner_manager.cc @@ -24,15 +24,15 @@ #include "pbd/error.h" #include "pbd/compose.h" -#include "pbd/pathscanner.h" +#include "pbd/file_utils.h" #include "pbd/stl_delete.h" #include "ardour/debug.h" #include "ardour/panner_manager.h" -#include "ardour/panner_search_path.h" +#include "ardour/search_paths.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -63,7 +63,24 @@ PannerManager::instance () static bool panner_filter (const string& str, void */*arg*/) { -#ifdef __APPLE__ +#ifdef COMPILER_MSVC + /** + * Different build targets (Debug / Release etc) use different versions + * of the 'C' runtime (which can't be 'mixed & matched'). Therefore, in + * case the supplied search path contains multiple version(s) of a given + * panner module, only select the one(s) which match the current build + * target (otherwise, all hell will break loose !!) + */ + #if defined (_DEBUG) + return str.length() > 12 && (str.find ("panner_") == 0) && (str.find ("D.dll") == (str.length() - 5)); + #elif defined (RDC_BUILD) + return str.length() > 14 && (str.find ("panner_") == 0) && (str.find ("RDC.dll") == (str.length() - 7)); + #elif defined (_WIN64) + return str.length() > 13 && (str.find ("panner_") == 0) && (str.find ("64.dll") == (str.length() - 6)); + #else + return str.length() > 13 && (str.find ("panner_") == 0) && (str.find ("32.dll") == (str.length() - 6)); + #endif +#elif defined (__APPLE__) return str[0] != '.' && (str.length() > 6 && str.find (".dylib") == (str.length() - 6)); #else return str[0] != '.' && (str.length() > 3 && (str.find (".so") == (str.length() - 3) || str.find (".dll") == (str.length() - 4))); @@ -73,19 +90,15 @@ static bool panner_filter (const string& str, void */*arg*/) void PannerManager::discover_panners () { - PathScanner scanner; - std::vector *panner_modules; - std::string search_path = panner_search_path().to_string(); + std::vector panner_modules; - DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1\n"), search_path)); + DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1\n"), panner_search_path().to_string())); - panner_modules = scanner (search_path, panner_filter, 0, false, true, 1, true); + find_files_matching_filter (panner_modules, panner_search_path(), panner_filter, 0, false, true, true); - for (vector::iterator i = panner_modules->begin(); i != panner_modules->end(); ++i) { - panner_discover (**i); + for (vector::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) { + panner_discover (*i); } - - vector_delete (panner_modules); } int @@ -106,6 +119,8 @@ PannerManager::panner_discover (string path) if (i == panner_info.end()) { panner_info.push_back (pinfo); DEBUG_TRACE (DEBUG::Panning, string_compose(_("Panner discovered: \"%1\" in %2\n"), pinfo->descriptor.name, path)); + } else { + delete pinfo; } }