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
This commit is contained in:
Paul Davis 2011-04-02 13:53:03 +00:00
parent 1eb753b842
commit 483a88d54e
6 changed files with 96 additions and 3 deletions

View File

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

View File

@ -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__ */

View File

@ -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");

View File

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

View File

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

View File

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