summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-04-02 13:53:03 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-04-02 13:53:03 +0000
commit483a88d54e11dc612d8ebf6b8f8c830650cec77e (patch)
treeec46ef660397dd20b0ac93b8413fa4fc1e638de6 /libs
parent1eb753b8429b1524016c14d6a21ba070e1c56141 (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')
-rw-r--r--libs/ardour/ardour/directory_names.h1
-rw-r--r--libs/ardour/ardour/export_formats_search_path.h39
-rw-r--r--libs/ardour/directory_names.cc1
-rw-r--r--libs/ardour/export_formats_search_path.cc52
-rw-r--r--libs/ardour/export_profile_manager.cc5
-rw-r--r--libs/ardour/wscript1
6 files changed, 96 insertions, 3 deletions
diff --git a/libs/ardour/ardour/directory_names.h b/libs/ardour/ardour/directory_names.h
index db87d347aa..a4235dd9c0 100644
--- a/libs/ardour/ardour/directory_names.h
+++ b/libs/ardour/ardour/directory_names.h
@@ -15,6 +15,7 @@ extern const char* const dead_dir_name;
extern const char* const interchange_dir_name;
extern const char* const peak_dir_name;
extern const char* const export_dir_name;
+extern const char* const export_formats_dir_name;
extern const char* const templates_dir_name;
extern const char* const route_templates_dir_name;
extern const char* const surfaces_dir_name;
diff --git a/libs/ardour/ardour/export_formats_search_path.h b/libs/ardour/ardour/export_formats_search_path.h
new file mode 100644
index 0000000000..051eff56b5
--- /dev/null
+++ b/libs/ardour/ardour/export_formats_search_path.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2011 Paul Davis
+
+ 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.
+*/
+
+#ifndef __ardour_export_formats_search_path_h__
+#define __ardour_export_formats_search_path_h__
+
+#include "pbd/search_path.h"
+
+namespace ARDOUR {
+
+ /**
+ * return a SearchPath containing directories in which to look for
+ * export_formats.
+ *
+ * If ARDOUR_EXPORT_FORMATS_PATH is defined then the SearchPath returned
+ * will contain only those directories specified in it, otherwise it will
+ * contain the user and system directories which may contain control
+ * surface plugins.
+ */
+ PBD::SearchPath export_formats_search_path ();
+
+} // namespace ARDOUR
+
+#endif /* __ardour_export_formats_search_path_h__ */
diff --git a/libs/ardour/directory_names.cc b/libs/ardour/directory_names.cc
index 32e46d9951..571600670c 100644
--- a/libs/ardour/directory_names.cc
+++ b/libs/ardour/directory_names.cc
@@ -12,6 +12,7 @@ const char* const peak_dir_name = X_("peaks");
const char* const dead_dir_name = X_("dead");
const char* const interchange_dir_name = X_("interchange");
const char* const export_dir_name = X_("export");
+const char* const export_formats_dir_name = X_("export");
const char* const templates_dir_name = X_("templates");
const char* const route_templates_dir_name = X_("route_templates");
const char* const surfaces_dir_name = X_("surfaces");
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
diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc
index ff11262109..4d2b7795a4 100644
--- a/libs/ardour/export_profile_manager.cc
+++ b/libs/ardour/export_profile_manager.cc
@@ -29,6 +29,7 @@
#include "ardour/export_profile_manager.h"
#include "ardour/export_format_specification.h"
+#include "ardour/export_formats_search_path.h"
#include "ardour/export_timespan.h"
#include "ardour/export_channel_configuration.h"
#include "ardour/export_filename.h"
@@ -60,14 +61,12 @@ ExportProfileManager::ExportProfileManager (Session & s, std::string xml_node_na
, format_list (new FormatList ())
{
-
/* Initialize path variables */
export_config_dir = user_config_directory();
export_config_dir /= "export";
- search_path += export_config_dir;
- search_path += system_data_search_path().add_subdirectory_to_paths("export");
+ search_path += export_formats_search_path();
info << string_compose (_("Searching for export formats in %1"), search_path.to_string()) << endmsg;
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index 4b2fd546bb..f95b22d572 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -88,6 +88,7 @@ libardour_sources = [
'export_format_manager.cc',
'export_format_specification.cc',
'export_formats.cc',
+ 'export_formats_search_path.cc',
'export_graph_builder.cc',
'export_handler.cc',
'export_preset.cc',