--- a/src/utils/pathut.cpp
+++ b/src/utils/pathut.cpp
@@ -360,6 +360,26 @@
return ret;
}
+bool makepath(const string& ipath)
+{
+ string path = path_canon(ipath);
+ vector<string> elems;
+ stringToTokens(path, elems, "/");
+ path = "/";
+ for (vector<string>::const_iterator it = elems.begin();
+ it != elems.end(); it++){
+ path += *it;
+ // Not using path_isdir() here, because this cant grok symlinks
+ // If we hit an existing file, no worry, mkdir will just fail.
+ if (access(path.c_str(), 0) != 0) {
+ if (mkdir(path.c_str(), 0700) != 0) {
+ return false;
+ }
+ }
+ path += "/";
+ }
+ return true;
+}
vector<string> path_dirglob(const string &dir, const string pattern)
{
@@ -502,6 +522,10 @@
}
return url;
}
+bool urlisfileurl(const string& url)
+{
+ return url.find("file://") == 0;
+}
// Printable url: this is used to transcode from the system charset
// into either utf-8 if transcoding succeeds, or url-encoded