From 388749ada52bb177370f4f58766458b030b8a50a Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Tue, 6 Nov 2012 22:56:44 +0100 Subject: [PATCH] recognize '\\' as a possible directory separator libgen.h confirmed to work with mingw, thanks foxblock fixes #28 --- src/loader/utility.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; -- 2.39.2