From ff7785142de6fb8fa57e3334f76195122fad111b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 7 Dec 2011 17:45:18 +0000 Subject: [PATCH] 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 --- libs/ardour/session.cc | 56 ++++++++++++++++++++---------------------- 1 file 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 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::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 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::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::iterator i = dirs.begin(); i != dirs.end(); ++i) {