diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 10 |
1 files changed, 10 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) { |