permit envvar to define where to find MIDI binding maps (for bundle, or other reasons)

git-svn-id: svn://localhost/ardour2/branches/3.0@9203 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-03-25 21:21:05 +00:00
parent 3d51ea0ed2
commit 4ef712df25

View file

@ -22,6 +22,8 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <glibmm/miscutils.h>
#include "pbd/controllable_descriptor.h" #include "pbd/controllable_descriptor.h"
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/failed_constructor.h" #include "pbd/failed_constructor.h"
@ -85,13 +87,21 @@ GenericMidiControlProtocol::~GenericMidiControlProtocol ()
tear_down_gui (); tear_down_gui ();
} }
static const char * const midimap_env_variable_name = "ARDOUR_MIDIMAPS_PATH";
static const char* const midi_map_dir_name = "midi_maps"; static const char* const midi_map_dir_name = "midi_maps";
static const char* const midi_map_suffix = ".map"; static const char* const midi_map_suffix = ".map";
static sys::path static sys::path
system_midi_map_search_path () system_midi_map_search_path ()
{ {
SearchPath spath(system_data_search_path()); bool midimap_path_defined = false;
sys::path spath_env (Glib::getenv (midimap_env_variable_name, midimap_path_defined));
if (midimap_path_defined) {
return spath_env;
}
SearchPath spath (system_data_search_path());
spath.add_subdirectory_to_paths(midi_map_dir_name); spath.add_subdirectory_to_paths(midi_map_dir_name);
// just return the first directory in the search path that exists // just return the first directory in the search path that exists