mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-12-21 01:33:05 +00:00
common/file_util: Remove unnecessary return at end of void StripTailDirSlashes()
While we're at it, also invert the conditional into a guard clause.
This commit is contained in:
parent
11e9bee91d
commit
e7ab0e9127
1 changed files with 8 additions and 6 deletions
|
@ -78,13 +78,15 @@ namespace FileUtil {
|
||||||
// Remove any ending forward slashes from directory paths
|
// Remove any ending forward slashes from directory paths
|
||||||
// Modifies argument.
|
// Modifies argument.
|
||||||
static void StripTailDirSlashes(std::string& fname) {
|
static void StripTailDirSlashes(std::string& fname) {
|
||||||
if (fname.length() > 1) {
|
if (fname.length() <= 1) {
|
||||||
std::size_t i = fname.length();
|
return;
|
||||||
while (i > 0 && fname[i - 1] == DIR_SEP_CHR)
|
|
||||||
--i;
|
|
||||||
fname.resize(i);
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
std::size_t i = fname.length();
|
||||||
|
while (i > 0 && fname[i - 1] == DIR_SEP_CHR) {
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
fname.resize(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Exists(const std::string& filename) {
|
bool Exists(const std::string& filename) {
|
||||||
|
|
Loading…
Reference in a new issue