Common: Remove File::GetFilename().

This commit is contained in:
Unknown W. Brackets 2021-05-14 23:08:00 -07:00
parent b74ecd5fa0
commit a097403298
5 changed files with 4 additions and 15 deletions

View file

@ -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) {

View file

@ -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);

View file

@ -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());

View file

@ -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);

View file

@ -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;