summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-06-24 01:59:01 +0300
committerAndrei Karas <akaras@inbox.ru>2019-06-24 01:59:01 +0300
commita6445adf61a87f73a3cd7781c36e36e228ac526e (patch)
tree6e291125a2fb15ae36e5c65af9b8bb1360b1eaea /src/utils/stringutils.cpp
parentbdc467e9f8d7c72d912eb7fdc434b3a14b52d901 (diff)
downloadManaVerse-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.gz
ManaVerse-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.bz2
ManaVerse-a6445adf61a87f73a3cd7781c36e36e228ac526e.tar.xz
ManaVerse-a6445adf61a87f73a3cd7781c36e36e228ac526e.zip
Fix code style
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp14
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;