Transfer 'lv2_bundled_search_path()' into 'libs/ardour/search_paths.cc'
[ardour.git] / libs / ardour / search_paths.cc
index 243e5207764c5ec0659624558e4683eb563fdfa5..0fc9f0c4f5fe29d9da64fcb3351c6e4970063d09 100644 (file)
 
 #include <glibmm/miscutils.h>
 
+#include "pbd/pathexpand.h"
+
 #include "ardour/search_paths.h"
 #include "ardour/directory_names.h"
 #include "ardour/filesystem_paths.h"
 
 namespace {
        const char * const backend_env_variable_name = "ARDOUR_BACKEND_PATH";
+       const char * const surfaces_env_variable_name = "ARDOUR_SURFACES_PATH";
+       const char * const export_env_variable_name = "ARDOUR_EXPORT_FORMATS_PATH";
+       const char * const ladspa_env_variable_name = "LADSPA_PATH";
 } // anonymous
 
 using namespace PBD;
@@ -43,4 +48,65 @@ backend_search_path ()
        return spath;
 }
 
+Searchpath
+control_protocol_search_path ()
+{
+       Searchpath spath(user_config_directory ());
+       spath += ardour_dll_directory ();
+       spath.add_subdirectory_to_paths (surfaces_dir_name);
+       
+       spath += Searchpath(Glib::getenv(surfaces_env_variable_name));
+       return spath;
+}
+
+Searchpath
+export_formats_search_path ()
+{
+       Searchpath spath (ardour_data_search_path());
+       spath.add_subdirectory_to_paths (export_formats_dir_name);
+
+       bool export_formats_path_defined = false;
+       Searchpath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined));
+
+       if (export_formats_path_defined) {
+               spath += spath_env;
+       }
+
+       return spath;
+}
+
+Searchpath
+ladspa_search_path ()
+{
+       Searchpath spath_env (Glib::getenv(ladspa_env_variable_name));
+
+       Searchpath spath (user_config_directory ());
+
+       spath += ardour_dll_directory ();
+       spath.add_subdirectory_to_paths (ladspa_dir_name);
+
+#ifndef PLATFORM_WINDOWS
+       spath.push_back ("/usr/local/lib64/ladspa");
+       spath.push_back ("/usr/local/lib/ladspa");
+       spath.push_back ("/usr/lib64/ladspa");
+       spath.push_back ("/usr/lib/ladspa");
+#endif
+
+#ifdef __APPLE__
+       spath.push_back (path_expand ("~/Library/Audio/Plug-Ins/LADSPA"));
+       spath.push_back ("/Library/Audio/Plug-Ins/LADSPA");
+#endif
+
+       return spath_env + spath;
+}
+
+Searchpath
+lv2_bundled_search_path ()
+{
+       Searchpath spath( ardour_dll_directory () );
+       spath.add_subdirectory_to_paths ("LV2");
+
+       return spath;
+}
+
 } // namespace ARDOUR