From c37a944b15d67c1c4287c29647172f1ac54f1dee Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Wed, 27 Jun 2007 12:12:26 +0000 Subject: Add ARDOUR::config_search_path git-svn-id: svn://localhost/ardour2/trunk@2053 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/filesystem_paths.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'libs/ardour/filesystem_paths.cc') 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 +#include #include #include #include +#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 -- cgit v1.2.3