summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/filesystem_paths.h4
-rw-r--r--libs/ardour/configuration.cc27
-rw-r--r--libs/ardour/filesystem_paths.cc27
3 files changed, 29 insertions, 29 deletions
diff --git a/libs/ardour/ardour/filesystem_paths.h b/libs/ardour/ardour/filesystem_paths.h
index c5b8b2a057..b5ef1a91c9 100644
--- a/libs/ardour/ardour/filesystem_paths.h
+++ b/libs/ardour/ardour/filesystem_paths.h
@@ -39,7 +39,9 @@ namespace ARDOUR {
*/
sys::path ardour_module_directory ();
- SearchPath config_search_path ();
+ SearchPath ardour_search_path ();
+
+ SearchPath system_config_search_path ();
} // namespace ARDOUR
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index 2c0143cdba..903f853ef5 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -23,8 +23,8 @@
#include <pbd/failed_constructor.h>
#include <pbd/xml++.h>
#include <pbd/filesystem.h>
+#include <pbd/file_utils.h>
-#include <ardour/ardour.h>
#include <ardour/configuration.h>
#include <ardour/audio_diskstream.h>
#include <ardour/control_protocol_manager.h>
@@ -80,17 +80,18 @@ Configuration::load_state ()
{
bool found = false;
- string rcfile;
+ sys::path system_rc_file;
/* load system configuration first */
-
- rcfile = find_config_file ("ardour_system.rc");
-
- if (rcfile.length()) {
-
+
+ if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(),
+ "ardour_system.rc", system_rc_file) )
+ {
XMLTree tree;
found = true;
+ string rcfile = system_rc_file.to_string();
+
cerr << string_compose (_("loading system configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile.c_str())) {
@@ -106,16 +107,18 @@ Configuration::load_state ()
}
}
-
/* now load configuration file for user */
-
- rcfile = find_config_file ("ardour.rc");
- if (rcfile.length()) {
+ sys::path user_rc_file;
+ if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
+ "ardour.rc", user_rc_file))
+ {
XMLTree tree;
found = true;
-
+
+ string rcfile = user_rc_file.to_string();
+
cerr << string_compose (_("loading user configuration file %1"), rcfile) << endl;
if (!tree.read (rcfile)) {
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc
index e41b9954cf..69b00393a8 100644
--- a/libs/ardour/filesystem_paths.cc
+++ b/libs/ardour/filesystem_paths.cc
@@ -27,10 +27,6 @@
#define WITH_STATIC_PATHS 1
-namespace {
- const char * const config_env_variable_name = "ARDOUR_CONFIG_PATH";
-}
-
namespace ARDOUR {
using std::string;
@@ -65,29 +61,28 @@ ardour_module_directory ()
}
SearchPath
-config_search_path ()
+ardour_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;
- }
+ SearchPath spath_env(Glib::getenv("ARDOUR_PATH"));
+ return spath_env;
+}
+SearchPath
+system_config_search_path ()
+{
#ifdef WITH_STATIC_PATHS
- SearchPath spath(string(CONFIG_DIR));
+ SearchPath config_path(string(CONFIG_DIR));
#else
- SearchPath spath(system_config_directories());
+ SearchPath config_path(system_config_directories());
#endif
- spath.add_subdirectory_to_paths("ardour2");
+ config_path.add_subdirectory_to_paths("ardour2");
- return spath;
+ return config_path;
}
} // namespace ARDOUR