#define ARDOUR_FILESYSTEM_PATHS_INCLUDED
#include <pbd/filesystem.h>
+#include <pbd/search_path.h>
namespace ARDOUR {
using namespace PBD;
-
+
/**
* @return the path to the directory used to store user specific ardour
* configuration files.
*/
sys::path ardour_module_directory ();
+ SearchPath config_search_path ();
+
} // namespace ARDOUR
#endif
*/
#include <pbd/error.h>
+#include <pbd/filesystem_paths.h>
#include <glibmm/miscutils.h>
#include <ardour/directory_names.h>
#include <ardour/filesystem_paths.h>
+#define WITH_STATIC_PATHS 1
+
+namespace {
+ const char * const config_env_variable_name = "ARDOUR_CONFIG_PATH";
+}
+
namespace ARDOUR {
using std::string;
return module_directory;
}
+SearchPath
+config_search_path ()
+{
+ bool config_path_defined = false;
+ SearchPath spath_env(Glib::getenv(config_env_variable_name, config_path_defined));
+
+ if (config_path_defined)
+ {
+ return spath_env;
+ }
+
+#ifdef WITH_STATIC_PATHS
+
+ SearchPath spath(string(CONFIG_DIR));
+
+#else
+
+ SearchPath spath(system_config_directories());
+
+#endif
+
+ spath.add_subdirectory_to_paths("ardour2");
+
+ return spath;
+}
+
} // namespace ARDOUR