13
0

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
This commit is contained in:
Paul Davis 2011-12-07 17:45:18 +00:00
parent 186283a3c4
commit ff7785142d

View File

@ -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) {