From a097403298eef706e82de25d1a20e605b5ac2de4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 14 May 2021 23:08:00 -0700 Subject: [PATCH] Common: Remove File::GetFilename(). --- Common/File/FileUtil.cpp | 8 -------- Common/File/FileUtil.h | 3 --- Common/File/PathBrowser.cpp | 4 ++-- Core/System.cpp | 2 +- UI/GameInfoCache.cpp | 2 +- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Common/File/FileUtil.cpp b/Common/File/FileUtil.cpp index 64b661395a..c360055ccb 100644 --- a/Common/File/FileUtil.cpp +++ b/Common/File/FileUtil.cpp @@ -578,14 +578,6 @@ std::string GetDir(const std::string &path) { return cutpath; } -std::string GetFilename(std::string path) { - size_t off = GetDir(path).size() + 1; - if (off < path.size()) - return path.substr(off); - else - return path; -} - std::string GetFileExtension(const std::string & fn) { size_t pos = fn.rfind("."); if (pos == std::string::npos) { diff --git a/Common/File/FileUtil.h b/Common/File/FileUtil.h index a077c0c237..b918d90d4d 100644 --- a/Common/File/FileUtil.h +++ b/Common/File/FileUtil.h @@ -59,9 +59,6 @@ std::string GetFileExtension(const std::string &filename); // Extracts the directory from a path. std::string GetDir(const std::string &path); -// Extracts the filename from a path. -std::string GetFilename(std::string path); - // Returns struct with modification date of file bool GetModifTime(const Path &filename, tm &return_time); diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index 61797f2a1b..6608481636 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -209,9 +209,9 @@ bool PathBrowser::IsListingReady() { } std::string PathBrowser::GetFriendlyPath() const { - std::string str = GetPath().ToString(); + std::string str = GetPath().ToVisualString(); // Show relative to memstick root if there. - std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToString(); + std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToVisualString(); if (startsWith(str, root)) { return std::string("ms:/") + str.substr(root.size()); diff --git a/Core/System.cpp b/Core/System.cpp index 0fc1cc48d7..c2a5d01169 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -206,7 +206,7 @@ bool DiscIDFromGEDumpPath(const Path &path, FileLoader *fileLoader, std::string } // Fall back to using the filename. - std::string filename = File::GetFilename(path.ToString()); + std::string filename = path.GetFilename(); // Could be more discerning, but hey.. if (filename.size() > 10 && filename[0] == 'U' && filename[9] == '_') { *id = filename.substr(0, 9); diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 99873b9172..64e95df69e 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -206,7 +206,7 @@ bool GameInfo::LoadFromPath(const Path &gamePath) { filePath_ = gamePath; // This is a fallback title, while we're loading / if unable to load. - title = File::GetFilename(filePath_.ToString()); + title = filePath_.GetFilename(); } return true;