summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-16 01:39:44 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-16 02:24:22 +0300
commit654285675ececa142877d86e6f730d040625fc6e (patch)
treec57e7d21a3b61acd2e1a179152dcb909ce1ececa /src/utils
parent103aa3f43e457ebfcd32fe5ea4624539dd32978d (diff)
downloadmanaplus-654285675ececa142877d86e6f730d040625fc6e.tar.gz
manaplus-654285675ececa142877d86e6f730d040625fc6e.tar.bz2
manaplus-654285675ececa142877d86e6f730d040625fc6e.tar.xz
manaplus-654285675ececa142877d86e6f730d040625fc6e.zip
Add dataPath to branding.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp10
-rw-r--r--src/utils/stringutils.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index dffec3f0c..953cbf58a 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -305,6 +305,16 @@ std::string getFileName(std::string path)
return path.substr(pos + 1);
}
+std::string getFileDir(std::string path)
+{
+ size_t pos = path.rfind("/");
+ if (pos == std::string::npos)
+ pos = path.rfind("\\");
+ if (pos == std::string::npos)
+ return "";
+ return path.substr(0, pos);
+}
+
std::string& replaceAll(std::string& context, const std::string& from,
const std::string& to)
{
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 796df92c5..140baf944 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -149,6 +149,8 @@ void getSafeUtf8String(std::string text, char *buf);
std::string getFileName(std::string path);
+std::string getFileDir(std::string path);
+
std::string& replaceAll(std::string& context, const std::string& from,
const std::string& to);