Switch to unified view

a/src/utils/pathut.cpp b/src/utils/pathut.cpp
...
...
64
#include <stack>
64
#include <stack>
65
#include <set>
65
#include <set>
66
#include <vector>
66
#include <vector>
67
67
68
#include "pathut.h"
68
#include "pathut.h"
69
#include "smallut.h"
69
70
70
using namespace std;
71
using namespace std;
71
72
72
#ifdef _WIN32
73
#ifdef _WIN32
73
/// Convert \ separators to /
74
/// Convert \ separators to /
...
...
394
#endif
395
#endif
395
    }
396
    }
396
    return s;
397
    return s;
397
}
398
}
398
399
399
#include <smallut.h>
400
string path_canon(const string& is, const string* cwd)
400
string path_canon(const string& is, const string* cwd)
401
{
401
{
402
    if (is.length() == 0) {
402
    if (is.length() == 0) {
403
        return is;
403
        return is;
404
    }
404
    }
...
...
454
        ret = "/";
454
        ret = "/";
455
    }
455
    }
456
    return ret;
456
    return ret;
457
}
457
}
458
458
459
bool makepath(const string& ipath)
459
bool path_makepath(const string& ipath, int mode)
460
{
460
{
461
    string path = path_canon(ipath);
461
    string path = path_canon(ipath);
462
    vector<string> elems;
462
    vector<string> elems;
463
    stringToTokens(path, elems, "/");
463
    stringToTokens(path, elems, "/");
464
    path = "/";
464
    path = "/";
...
...
471
#endif
471
#endif
472
        path += *it;
472
        path += *it;
473
        // Not using path_isdir() here, because this cant grok symlinks
473
        // Not using path_isdir() here, because this cant grok symlinks
474
        // If we hit an existing file, no worry, mkdir will just fail.
474
        // If we hit an existing file, no worry, mkdir will just fail.
475
        if (access(path.c_str(), 0) != 0) {
475
        if (access(path.c_str(), 0) != 0) {
476
            if (mkdir(path.c_str(), 0700) != 0)  {
476
            if (mkdir(path.c_str(), mode) != 0)  {
477
                return false;
477
                return false;
478
            }
478
            }
479
        }
479
        }
480
        path += "/";
480
        path += "/";
481
    }
481
    }