summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-06-27 12:12:26 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-06-27 12:12:26 +0000
commitc37a944b15d67c1c4287c29647172f1ac54f1dee (patch)
tree58301b1f5a8d8fc3fc9bc0f7ff89d6133b6539a4 /libs
parent1c8fc3c5843b135adc1ebceecc2ee8ffb6c8a3d4 (diff)
Add ARDOUR::config_search_path
git-svn-id: svn://localhost/ardour2/trunk@2053 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/filesystem_paths.h5
-rw-r--r--libs/ardour/filesystem_paths.cc33
2 files changed, 37 insertions, 1 deletions
diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h
index 9d7d6ba216..c5b8b2a057 100644
--- a/libs/ardour/ardour/filesystem_paths.h
+++ b/libs/ardour/ardour/filesystem_paths.h
@@ -21,11 +21,12 @@
#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.
@@ -38,6 +39,8 @@ namespace ARDOUR {
*/
sys::path ardour_module_directory ();
+ SearchPath config_search_path ();
+
} // namespace ARDOUR
#endif
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc
index 5ce4f4f7ed..e41b9954cf 100644
--- a/libs/ardour/filesystem_paths.cc
+++ b/libs/ardour/filesystem_paths.cc
@@ -18,12 +18,19 @@
*/
#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;
@@ -57,4 +64,30 @@ ardour_module_directory ()
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