diff options
author | Lioncash <mathew1800@gmail.com> | 2019-05-23 20:33:27 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-05-23 20:33:29 +0200 |
commit | e7ab0e91278c80eee110edda0c737ea05a4f0704 (patch) | |
tree | 96714ad5c5c932b1ced407121ff2d47740a5ed78 | |
parent | common/file_util: Make GetCurrentDir() return a std::optional (diff) | |
download | yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar.gz yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar.bz2 yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar.lz yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar.xz yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.tar.zst yuzu-e7ab0e91278c80eee110edda0c737ea05a4f0704.zip |
-rw-r--r-- | src/common/file_util.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index d8812837e..2d9374783 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -78,13 +78,15 @@ namespace FileUtil { // Remove any ending forward slashes from directory paths // Modifies argument. static void StripTailDirSlashes(std::string& fname) { - if (fname.length() > 1) { - std::size_t i = fname.length(); - while (i > 0 && fname[i - 1] == DIR_SEP_CHR) - --i; - fname.resize(i); + if (fname.length() <= 1) { + return; + } + + std::size_t i = fname.length(); + while (i > 0 && fname[i - 1] == DIR_SEP_CHR) { + --i; } - return; + fname.resize(i); } bool Exists(const std::string& filename) { |