fix going to wrong directory in tag editor

master
Andrzej Rybczak 15 years ago
parent ca956c3da3
commit 78cd46b756
  1. 6
      src/tag_editor.cpp

@ -872,7 +872,11 @@ void TagEditor::LocateSong(const MPD::Song &s)
if (itsBrowsedDir != s.GetDirectory()) if (itsBrowsedDir != s.GetDirectory())
{ {
itsBrowsedDir = s.GetDirectory(); itsBrowsedDir = s.GetDirectory();
itsBrowsedDir = itsBrowsedDir.substr(0, itsBrowsedDir.rfind('/')); size_t last_slash = itsBrowsedDir.rfind('/');
if (last_slash != std::string::npos)
itsBrowsedDir = itsBrowsedDir.substr(0, last_slash);
else
itsBrowsedDir = "/";
if (itsBrowsedDir.empty()) if (itsBrowsedDir.empty())
itsBrowsedDir = "/"; itsBrowsedDir = "/";
Dirs->Clear(); Dirs->Clear();

Loading…
Cancel
Save