diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-06-24 01:59:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-06-24 01:59:01 +0300 |
commit | a6445adf61a87f73a3cd7781c36e36e228ac526e (patch) | |
tree | 6e291125a2fb15ae36e5c65af9b8bb1360b1eaea /src/utils | |
parent | bdc467e9f8d7c72d912eb7fdc434b3a14b52d901 (diff) | |
download | mv-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.gz mv-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.bz2 mv-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.xz mv-a6445adf61a87f73a3cd7781c36e36e228ac526e.zip |
Fix code style
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 3af63f96e..99160905d 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -338,10 +338,11 @@ std::string getFileName(const std::string &path) { size_t pos1 = path.rfind('/'); const size_t pos2 = path.rfind('\\'); - if (pos1 == std::string::npos) - pos1 = pos2; - else if (pos2 != std::string::npos && pos2 > pos1) + if (pos1 == std::string::npos || + (pos2 != std::string::npos && pos2 > pos1)) + { pos1 = pos2; + } if (pos1 == std::string::npos) return path; @@ -352,10 +353,11 @@ std::string getFileDir(const std::string &path) { size_t pos1 = path.rfind('/'); const size_t pos2 = path.rfind('\\'); - if (pos1 == std::string::npos) - pos1 = pos2; - else if (pos2 != std::string::npos && pos2 > pos1) + if (pos1 == std::string::npos || + (pos2 != std::string::npos && pos2 > pos1)) + { pos1 = pos2; + } if (pos1 == std::string::npos) return path; |