From 4ef712df2571a59fbfc3b275f39447af4ede7bb4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 25 Mar 2011 21:21:05 +0000 Subject: [PATCH] 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 --- .../generic_midi/generic_midi_control_protocol.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index 36a4548a2a..be30ab20be 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -22,6 +22,8 @@ #include #include +#include + #include "pbd/controllable_descriptor.h" #include "pbd/error.h" #include "pbd/failed_constructor.h" @@ -85,13 +87,21 @@ GenericMidiControlProtocol::~GenericMidiControlProtocol () 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_suffix = ".map"; static sys::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); // just return the first directory in the search path that exists