diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-05-21 01:11:58 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-05-21 01:11:58 +0300 |
commit | 76e241392d2ad232b751c74df7cba9e5acfa7855 (patch) | |
tree | e58f72b379c1a4e1b86a4e85c6c0007109635b32 /src/filesys.cpp | |
parent | 73a18b9271bebddfe6716529bb13cad30869bc16 (diff) | |
parent | 52d857cf1527948e1db5eead457e51b6741de8a2 (diff) | |
download | minetest-76e241392d2ad232b751c74df7cba9e5acfa7855.tar.gz minetest-76e241392d2ad232b751c74df7cba9e5acfa7855.tar.bz2 minetest-76e241392d2ad232b751c74df7cba9e5acfa7855.zip |
Merge: New map directory structure and player passwords
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r-- | src/filesys.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp index 287090e8a..8248a13d4 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -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 |