diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-04-02 13:53:03 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-04-02 13:53:03 +0000 |
commit | 483a88d54e11dc612d8ebf6b8f8c830650cec77e (patch) | |
tree | ec46ef660397dd20b0ac93b8413fa4fc1e638de6 /libs/ardour/export_formats_search_path.cc | |
parent | 1eb753b8429b1524016c14d6a21ba070e1c56141 (diff) |
add the standard mechanism for search paths to the path used for export formats, so that we can find them in a bundle
git-svn-id: svn://localhost/ardour2/branches/3.0@9261 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/export_formats_search_path.cc')
-rw-r--r-- | libs/ardour/export_formats_search_path.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libs/ardour/export_formats_search_path.cc b/libs/ardour/export_formats_search_path.cc new file mode 100644 index 0000000000..53516be933 --- /dev/null +++ b/libs/ardour/export_formats_search_path.cc @@ -0,0 +1,52 @@ +/* + Copyright (C) 2007 Tim Mayberry + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <glibmm/miscutils.h> + +#include "ardour/export_formats_search_path.h" +#include "ardour/directory_names.h" +#include "ardour/filesystem_paths.h" + +namespace { + const char * const export_env_variable_name = "ARDOUR_EXPORT_FORMATS_PATH"; +} // anonymous + +using namespace PBD; + +namespace ARDOUR { + +SearchPath +export_formats_search_path () +{ + bool export_path_defined = false; + SearchPath spath_env (Glib::getenv(export_env_variable_name, export_path_defined)); + + if (export_path_defined) { + return spath_env; + } + + SearchPath spath (user_config_directory ()); + + spath += ardour_module_directory (); + spath.add_subdirectory_to_paths (export_formats_dir_name); + + return spath; +} + +} // namespace ARDOUR |