improved WORKING fix for search path issues
git-svn-id: svn://localhost/ardour2/branches/3.0@10940 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5ef06dd439
commit
ae63588c02
@ -43,8 +43,8 @@ CONFIG_VARIABLE (bool, punch_out, "punch-out", false)
|
||||
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
|
||||
CONFIG_VARIABLE (TimecodeFormat, timecode_format, "timecode-format", timecode_30)
|
||||
CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand)
|
||||
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", path_expand)
|
||||
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", path_expand)
|
||||
CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", search_path_expand)
|
||||
CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", search_path_expand)
|
||||
CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US")
|
||||
CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US")
|
||||
CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher)
|
||||
|
@ -59,7 +59,8 @@ int cmp_nocase (const std::string& s, const std::string& s2);
|
||||
|
||||
int touch_file(std::string path);
|
||||
|
||||
std::string path_expand (std::string);
|
||||
std::string path_expand (std::string); /* single file path */
|
||||
std::string search_path_expand (std::string); /* colon-separated search path */
|
||||
std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0);
|
||||
bool path_is_paired (std::string path, std::string& pair_base);
|
||||
|
||||
|
@ -4216,9 +4216,32 @@ Session::end_time_changed (framepos_t old)
|
||||
string
|
||||
Session::source_search_path (DataType type) const
|
||||
{
|
||||
string search_path;
|
||||
vector<string> s;
|
||||
|
||||
/* first check the explicit (possibly user-specified) search path
|
||||
if (session_dirs.size() == 1) {
|
||||
switch (type) {
|
||||
case DataType::AUDIO:
|
||||
s.push_back ( _session_dir->sound_path().to_string());
|
||||
break;
|
||||
case DataType::MIDI:
|
||||
s.push_back (_session_dir->midi_path().to_string());
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
|
||||
SessionDirectory sdir (i->path);
|
||||
switch (type) {
|
||||
case DataType::AUDIO:
|
||||
s.push_back (sdir.sound_path().to_string());
|
||||
break;
|
||||
case DataType::MIDI:
|
||||
s.push_back (sdir.midi_path().to_string());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* now check the explicit (possibly user-specified) search path
|
||||
*/
|
||||
|
||||
vector<string> dirs;
|
||||
@ -4233,41 +4256,27 @@ Session::source_search_path (DataType type) const
|
||||
}
|
||||
|
||||
for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
|
||||
search_path += ':';
|
||||
search_path += *i;
|
||||
|
||||
}
|
||||
vector<string>::iterator si;
|
||||
|
||||
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:
|
||||
search_path = _session_dir->sound_path().to_string();
|
||||
break;
|
||||
case DataType::MIDI:
|
||||
search_path = _session_dir->midi_path().to_string();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
|
||||
SessionDirectory sdir (i->path);
|
||||
if (!search_path.empty()) {
|
||||
search_path += ':';
|
||||
}
|
||||
switch (type) {
|
||||
case DataType::AUDIO:
|
||||
search_path += sdir.sound_path().to_string();
|
||||
break;
|
||||
case DataType::MIDI:
|
||||
search_path += sdir.midi_path().to_string();
|
||||
for (si = s.begin(); si != s.end(); ++si) {
|
||||
if ((*si) == *i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (si == s.end()) {
|
||||
s.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
string search_path;
|
||||
|
||||
for (vector<string>::iterator si = s.begin(); si != s.end(); ++si) {
|
||||
if (!search_path.empty()) {
|
||||
search_path += ':';
|
||||
}
|
||||
search_path += *si;
|
||||
}
|
||||
|
||||
return search_path;
|
||||
@ -4283,7 +4292,15 @@ Session::ensure_search_path_includes (const string& path, DataType type)
|
||||
return;
|
||||
}
|
||||
|
||||
search_path = source_search_path (type);
|
||||
switch (type) {
|
||||
case DataType::AUDIO:
|
||||
search_path = config.get_audio_search_path ();
|
||||
break;
|
||||
case DataType::MIDI:
|
||||
search_path = config.get_midi_search_path ();
|
||||
break;
|
||||
}
|
||||
|
||||
split (search_path, dirs, ':');
|
||||
|
||||
for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
|
||||
|
@ -349,6 +349,34 @@ path_expand (string path)
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
search_path_expand (string path)
|
||||
{
|
||||
if (path.empty()) {
|
||||
return path;
|
||||
}
|
||||
|
||||
vector<string> s;
|
||||
vector<string> n;
|
||||
|
||||
split (path, s, ':');
|
||||
|
||||
for (vector<string>::iterator i = s.begin(); i != s.end(); ++i) {
|
||||
n.push_back (path_expand (*i));
|
||||
}
|
||||
|
||||
string r;
|
||||
|
||||
for (vector<string>::iterator i = n.begin(); i != n.end(); ++i) {
|
||||
if (!r.empty()) {
|
||||
r += ':';
|
||||
}
|
||||
r += *i;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
string
|
||||
CFStringRefToStdString(CFStringRef stringRef)
|
||||
|
Loading…
Reference in New Issue
Block a user