browser: if current dir doesn't exists, go down one level automatically
This commit is contained in:
@@ -372,6 +372,12 @@ std::string ExtractTopName(const std::string &s)
|
|||||||
return slash != std::string::npos ? s.substr(++slash) : s;
|
return slash != std::string::npos ? s.substr(++slash) : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string PathGoDownOneLevel(const std::string &path)
|
||||||
|
{
|
||||||
|
size_t i = path.rfind('/');
|
||||||
|
return i == std::string::npos ? "/" : path.substr(0, i);
|
||||||
|
}
|
||||||
|
|
||||||
std::basic_string<my_char_t> Scroller(const std::basic_string<my_char_t> &str, size_t &pos, size_t width)
|
std::basic_string<my_char_t> Scroller(const std::basic_string<my_char_t> &str, size_t &pos, size_t width)
|
||||||
{
|
{
|
||||||
std::basic_string<my_char_t> s(str);
|
std::basic_string<my_char_t> s(str);
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ std::string FindSharedDir(const MPD::SongList &);
|
|||||||
#endif // HAVE_TAGLIB_H
|
#endif // HAVE_TAGLIB_H
|
||||||
std::string FindSharedDir(const std::string &, const std::string &);
|
std::string FindSharedDir(const std::string &, const std::string &);
|
||||||
std::string ExtractTopName(const std::string &);
|
std::string ExtractTopName(const std::string &);
|
||||||
|
std::string PathGoDownOneLevel(const std::string &path);
|
||||||
|
|
||||||
std::string GetLineValue(std::string &, char = '"', char = '"', bool = 0);
|
std::string GetLineValue(std::string &, char = '"', char = '"', bool = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,13 @@ void MPD::Connection::UpdateStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if CheckForErrors() invokes callback, it can do some communication with mpd.
|
||||||
|
// the problem is, we *have* to be out from idle mode here and issuing commands
|
||||||
|
// will enter it again, which certainly is not desired, so let's block it for
|
||||||
|
// a while.
|
||||||
|
BlockIdle(true);
|
||||||
CheckForErrors();
|
CheckForErrors();
|
||||||
|
BlockIdle(false);
|
||||||
|
|
||||||
if (!itsConnection)
|
if (!itsConnection)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -205,6 +205,11 @@ void NcmpcppErrorCallback(MPD::Connection *, int errorid, const char *msg, void
|
|||||||
ShowMessage("Password accepted!");
|
ShowMessage("Password accepted!");
|
||||||
wFooter->SetGetStringHelper(StatusbarGetStringHelper);
|
wFooter->SetGetStringHelper(StatusbarGetStringHelper);
|
||||||
}
|
}
|
||||||
|
else if ((errorid >> 8) == MPD_SERVER_ERROR_NO_EXIST && myScreen == myBrowser)
|
||||||
|
{
|
||||||
|
myBrowser->GetDirectory(PathGoDownOneLevel(myBrowser->CurrentDir()));
|
||||||
|
myBrowser->Refresh();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ShowMessage("%s", msg);
|
ShowMessage("%s", msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user