diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 0a1a425830..3c6c6449d3 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -51,29 +51,15 @@ // REMEMBER: strdup considered harmful! namespace File { -// Remove any ending forward slashes from directory paths -// Modifies argument. -static void StripTailDirSlashes(std::string& fname) -{ - if (fname.length() > 1) - { - while (fname.back() == DIR_SEP_CHR) - fname.pop_back(); - } -} - // Returns true if file filename exists bool Exists(const std::string& filename) { struct stat file_info; - std::string copy(filename); - StripTailDirSlashes(copy); - #ifdef _WIN32 - int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); + int result = _tstat64(UTF8ToTStr(filename).c_str(), &file_info); #else - int result = stat(copy.c_str(), &file_info); + int result = stat(filename.c_str(), &file_info); #endif return (result == 0); @@ -84,13 +70,10 @@ bool IsDirectory(const std::string& filename) { struct stat file_info; - std::string copy(filename); - StripTailDirSlashes(copy); - #ifdef _WIN32 - int result = _tstat64(UTF8ToTStr(copy).c_str(), &file_info); + int result = _tstat64(UTF8ToTStr(filename).c_str(), &file_info); #else - int result = stat(copy.c_str(), &file_info); + int result = stat(filename.c_str(), &file_info); #endif if (result < 0)