diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-16 01:39:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-16 02:24:22 +0300 |
commit | 654285675ececa142877d86e6f730d040625fc6e (patch) | |
tree | c57e7d21a3b61acd2e1a179152dcb909ce1ececa /src/utils | |
parent | 103aa3f43e457ebfcd32fe5ea4624539dd32978d (diff) | |
download | plus-654285675ececa142877d86e6f730d040625fc6e.tar.gz plus-654285675ececa142877d86e6f730d040625fc6e.tar.bz2 plus-654285675ececa142877d86e6f730d040625fc6e.tar.xz plus-654285675ececa142877d86e6f730d040625fc6e.zip |
Add dataPath to branding.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 10 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
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); |