]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/filesys.cpp
+ clay and associated items
[dragonfireclient.git] / src / filesys.cpp
index 287090e8a94ec068a4ba92e755330481f69887fb..8248a13d46f3703c48061faa68f3b2e150289f8e 100644 (file)
@@ -290,5 +290,24 @@ bool RecursiveDeleteContent(std::string path)
        return true;
 }
 
+bool CreateAllDirs(std::string path)
+{
+
+       size_t pos;
+       std::vector<std::string> tocreate;
+       std::string basepath = path;
+       while(!PathExists(basepath))
+       {
+               tocreate.push_back(basepath);
+               pos = basepath.rfind('/');
+               if(pos == std::string::npos)
+                       return false;
+               basepath = basepath.substr(0,pos);
+       }
+       for(int i=tocreate.size()-1;i>=0;i--)
+               CreateDir(tocreate[i]);
+       return true;
+}
+
 } // namespace fs