- string scan_p = Glib::build_filename(ARDOUR::ardour_dll_directory(), "fst");
- if (!PBD::find_file ( PBD::Searchpath(scan_p), "ardour-vst-scanner", scanner_bin_path)) {
- PBD::warning << "VST scanner app (ardour-vst-scanner) not found in path " << scan_p << endmsg;
+#if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT
+ // source-tree (ardev, etc)
+ PBD::Searchpath vstsp(Glib::build_filename(ARDOUR::ardour_dll_directory(), "fst"));
+
+#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");
+#else
+ // on Unices additional internal-use binaries are deployed to $libdir
+ vstsp += ARDOUR::ardour_dll_directory();
+#endif
+
+ if (!PBD::find_file (vstsp,
+#ifdef PLATFORM_WINDOWS
+ #ifdef DEBUGGABLE_SCANNER_APP
+ #if defined(DEBUG) || defined(_DEBUG)
+ "ardour-vst-scannerD.exe"
+ #else
+ "ardour-vst-scannerRDC.exe"
+ #endif
+ #else
+ "ardour-vst-scanner.exe"
+ #endif
+#else
+ "ardour-vst-scanner"
+#endif
+ , scanner_bin_path)) {
+ PBD::warning << "VST scanner app (ardour-vst-scanner) not found in path " << vstsp.to_string() << endmsg;