X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2Futility.cpp;h=214c676dd26140aa349f34f3dc5c02fc1de80d47;hb=HEAD;hp=f5011e6fe243ea97685ffefab3eb7421b93d8aa2;hpb=ec8e74c6f78502fb4c1d971051960ce9f1757978;p=l2e.git diff --git a/src/loader/utility.cpp b/src/loader/utility.cpp index f5011e6..214c676 100644 --- a/src/loader/utility.cpp +++ b/src/loader/utility.cpp @@ -1,10 +1,3 @@ -/* - * utility.cpp - * - * Created on: Sep 1, 2012 - * Author: holy - */ - #include "utility.h" #include @@ -15,7 +8,6 @@ using std::string; namespace loader { string Dirname(const string &path) { - // unix version char *str(new char[path.size() + 1]); std::memcpy(str, path.c_str(), path.size()); str[path.size()] = '\0'; @@ -25,12 +17,13 @@ string Dirname(const string &path) { } string CatPath(const string &lhs, const string &rhs) { - // unix version string path(lhs); - if (!path.empty() && path[path.size() - 1] != '/') { + if (!path.empty() + && path[path.size() - 1] != '/' + && path[path.size() - 1] != '\\') { path += '/'; } - if (!rhs.empty() && rhs[0] == '/') { + if (!rhs.empty() && (rhs[0] == '/' || rhs[0] == '\\')) { path.append(rhs, 1, string::npos); } else { path += rhs;