13
0

Add ARDOUR::ardour_search_path that contains the directories in the ARDOUR_PATH environment variable.

Rename ARDOUR::config_search_path to ARDOUR::system_config_search_path

Use PBD::find_file_in_search_path in Configuration::load_state


git-svn-id: svn://localhost/ardour2/trunk@2054 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry 2007-06-27 12:12:28 +00:00
parent c37a944b15
commit bbc289dbe3
3 changed files with 29 additions and 29 deletions

View File

@ -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

View File

@ -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)) {

View File

@ -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