summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_patch_search_path.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-03-20 18:03:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-03-20 18:03:46 +0000
commit494635b99b9cdac42fd7a14e80c78ce437d6f606 (patch)
tree77d439eae950fef18f920c524badd03c11e94610 /libs/ardour/midi_patch_search_path.cc
parent1c399d5ebc542abf7132d90395c5c23b43935bdb (diff)
make MIDI Patch Manager search in $user_config_dir/patchfiles for midnam files as well as the per-session equivalent. need to stop it from doing at session shutdown time too.
git-svn-id: svn://localhost/ardour2/branches/3.0@11736 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_patch_search_path.cc')
-rw-r--r--libs/ardour/midi_patch_search_path.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/libs/ardour/midi_patch_search_path.cc b/libs/ardour/midi_patch_search_path.cc
new file mode 100644
index 0000000000..014e41f190
--- /dev/null
+++ b/libs/ardour/midi_patch_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/midi_name_search_path.h"
+#include "ardour/directory_names.h"
+#include "ardour/filesystem_paths.h"
+
+namespace {
+ const char * const midi_patch_env_variable_name = "ARDOUR_MIDI_PATCH_PATH";
+} // anonymous
+
+using namespace PBD;
+
+namespace ARDOUR {
+
+SearchPath
+midi_patch_search_path ()
+{
+ SearchPath spath (user_config_directory ());
+
+ spath += ardour_module_directory ();
+ spath.add_subdirectory_to_paths(midi_patch_dir_name);
+
+ bool midi_patch_path_defined = false;
+ SearchPath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined));
+
+ if (midi_patch_path_defined) {
+ spath += spath_env;
+ }
+
+ return spath;
+}
+
+} // namespace ARDOUR