]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/utility.cpp
removed stupid file headers that eclipse put in
[l2e.git] / src / loader / utility.cpp
index ee88ea0d0dc880a20126d38c87a81085c08a6b4c..214c676dd26140aa349f34f3dc5c02fc1de80d47 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * utility.cpp
- *
- *  Created on: Sep 1, 2012
- *      Author: holy
- */
-
 #include "utility.h"
 
 #include <cstring>
@@ -15,22 +8,22 @@ 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';
        string dn(dirname(str));
-       delete str;
+       delete[] str;
        return dn;
 }
 
 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;