From: Daniel Karbach Date: Tue, 6 Nov 2012 21:56:44 +0000 (+0100) Subject: recognize '\\' as a possible directory separator X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=388749ada52bb177370f4f58766458b030b8a50a;p=l2e.git recognize '\\' as a possible directory separator libgen.h confirmed to work with mingw, thanks foxblock fixes #28 --- diff --git a/src/loader/utility.cpp b/src/loader/utility.cpp index f5011e6..6d33667 100644 --- a/src/loader/utility.cpp +++ b/src/loader/utility.cpp @@ -15,7 +15,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 +24,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;