diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 6d06cb5ae8..21e2bea382 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -920,8 +920,8 @@ void GameBrowser::Refresh() { // Add any pinned paths before other directories. auto pinnedPaths = GetPinnedPaths(); - for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) { - DirButton *pinnedDir = gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT))); + for (const auto &pinnedPath : pinnedPaths) { + DirButton *pinnedDir = gameList_->Add(new DirButton(pinnedPath, pinnedPath.GetFilename(), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT))); pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick); pinnedDir->SetPinned(true); } @@ -1008,29 +1008,6 @@ std::vector GameBrowser::GetPinnedPaths() const { return results; } -std::string GameBrowser::GetBaseName(const std::string &path) const { -#ifndef _WIN32 - static const std::string sepChars = "/"; -#else - static const std::string sepChars = "/\\"; -#endif - - auto trailing = path.find_last_not_of(sepChars); - if (trailing != path.npos) { - size_t start = path.find_last_of(sepChars, trailing); - if (start != path.npos) { - return path.substr(start + 1, trailing - start); - } - return path.substr(0, trailing); - } - - size_t start = path.find_last_of(sepChars); - if (start != path.npos) { - return path.substr(start + 1); - } - return path; -} - void GameBrowser::GameButtonClick(UI::EventParams &e) { GameButton *button = static_cast(e.v); UI::EventParams e2{}; diff --git a/UI/MainScreen.h b/UI/MainScreen.h index 4d7e653e14..2f02794510 100644 --- a/UI/MainScreen.h +++ b/UI/MainScreen.h @@ -74,7 +74,6 @@ protected: private: bool IsCurrentPathPinned(); std::vector GetPinnedPaths() const; - std::string GetBaseName(const std::string &path) const; void GameButtonClick(UI::EventParams &e); void GameButtonHoldClick(UI::EventParams &e);