mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 14:45:43 +01:00
Add ARDOUR::config_search_path
git-svn-id: svn://localhost/ardour2/trunk@2053 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1c8fc3c584
commit
c37a944b15
2 changed files with 37 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue