summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-07 17:45:18 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-07 17:45:18 +0000
commitff7785142de6fb8fa57e3334f76195122fad111b (patch)
tree3f8a605b5b3d1984a1c5708ffe7a06eb3bf51e23 /libs
parent186283a3c484a71ad61d4e0db13efea6f1d9280c (diff)
fix up some logic so that we don't replicate the session dir path twice in the search path(s)
git-svn-id: svn://localhost/ardour2/branches/3.0@10937 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session.cc56
1 files changed, 27 insertions, 29 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index f72cfa7026..2ad97e7d9d 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -4218,6 +4218,32 @@ Session::source_search_path (DataType type) const
{
string search_path;
+ /* first check the explicit (possibly user-specified) search path
+ */
+
+ vector<string> dirs;
+
+ switch (type) {
+ case DataType::AUDIO:
+ split (config.get_audio_search_path (), dirs, ':');
+ break;
+ case DataType::MIDI:
+ split (config.get_midi_search_path (), dirs, ':');
+ break;
+ }
+
+ for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
+ search_path += ':';
+ search_path += *i;
+
+ }
+
+ if (!search_path.empty()) {
+ return search_path;
+ }
+
+ /* if there was nothing there, check the session dirs */
+
if (session_dirs.size() == 1) {
switch (type) {
case DataType::AUDIO:
@@ -4244,26 +4270,6 @@ Session::source_search_path (DataType type) const
}
}
- /* now add user-specified locations
- */
-
- vector<string> dirs;
-
- switch (type) {
- case DataType::AUDIO:
- split (config.get_audio_search_path (), dirs, ':');
- break;
- case DataType::MIDI:
- split (config.get_midi_search_path (), dirs, ':');
- break;
- }
-
- for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
- search_path += ':';
- search_path += *i;
-
- }
-
return search_path;
}
@@ -4277,15 +4283,7 @@ Session::ensure_search_path_includes (const string& path, DataType type)
return;
}
- switch (type) {
- case DataType::AUDIO:
- search_path = config.get_audio_search_path ();
- break;
- case DataType::MIDI:
- search_path = config.get_midi_search_path ();
- break;
- }
-
+ search_path = source_search_path (type);
split (search_path, dirs, ':');
for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {