Trying to fix bug again

This commit is contained in:
mathusummut
2019-04-05 00:59:05 +02:00
parent 6612918b0f
commit e8b52942f5
3 changed files with 16 additions and 2 deletions

View File

@@ -240,7 +240,8 @@ namespace Shared {
bool StartsWith(const std::string &str, const std::string &key); bool StartsWith(const std::string &str, const std::string &key);
bool EndsWith(const string &str, const string& key); bool EndsWith(const string &str, const string& key);
string endPathWithSlash(string &path, bool requireOSSlash = false); string endPathWithSlash(string& path, bool requireOSSlash = false);
string endPathWithSlash(string&& path, bool requireOSSlash = false);
string trimPathWithStartingSlash(string &path); string trimPathWithStartingSlash(string &path);
string updatePathClimbingParts(string &path, bool processPreviousDirTokenCheck = true); string updatePathClimbingParts(string &path, bool processPreviousDirTokenCheck = true);
string formatPath(string path); string formatPath(string path);

View File

@@ -552,6 +552,19 @@ namespace Shared {
return result; return result;
} }
string endPathWithSlash(string&& path, bool requireOSSlash) {
if (EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
string seperator = "/";
if (requireOSSlash == true) {
#if defined(WIN32)
seperator = "\\";
#endif
}
path += seperator;
}
return path;
}
string endPathWithSlash(string &path, bool requireOSSlash) { string endPathWithSlash(string &path, bool requireOSSlash) {
if (EndsWith(path, "/") == false && EndsWith(path, "\\") == false) { if (EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
string seperator = "/"; string seperator = "/";