fix searching in browser

it was taking whole path, take only top dir.
This commit is contained in:
Andrzej Rybczak
2009-02-16 19:52:11 +01:00
parent 0415fa37fe
commit 2a6e0fd7e8
5 changed files with 15 additions and 13 deletions

View File

@@ -41,12 +41,6 @@ namespace
if (the_pos == 0 && the_pos != string::npos)
s = s.substr(4);
}
inline string extract_top_directory(const string &s)
{
size_t slash = s.rfind("/");
return slash != string::npos ? s.substr(++slash) : s;
}
}
bool ConnectToMPD()
@@ -207,7 +201,7 @@ bool CaseInsensitiveSorting::operator()(const Item &a, const Item &b)
switch (a.type)
{
case itDirectory:
return operator()(extract_top_directory(a.name), extract_top_directory(b.name));
return operator()(ExtractTopDirectory(a.name), ExtractTopDirectory(b.name));
case itPlaylist:
return operator()(a.name, b.name);
case itSong:
@@ -287,6 +281,12 @@ string GetLineValue(string &line, char a, char b, bool once)
return "";
}
std::string ExtractTopDirectory(const std::string &s)
{
size_t slash = s.rfind("/");
return slash != string::npos ? s.substr(++slash) : s;
}
const Buffer &ShowTag(const string &tag)
{
static Buffer result;