diff options
author | Ciaran Gultnieks <ciaran@ciarang.com> | 2011-05-18 16:48:27 +0100 |
---|---|---|
committer | Ciaran Gultnieks <ciaran@ciarang.com> | 2011-05-18 16:48:27 +0100 |
commit | e09fec3373abcf836635dc33a95e9b9975058eb9 (patch) | |
tree | 216ee7d4503bef9297edf67de70cdde5dda51f3e /src/filesys.cpp | |
parent | f1bdc6b187836f9741ac0512a0f10414002c647d (diff) | |
download | minetest-e09fec3373abcf836635dc33a95e9b9975058eb9.tar.gz minetest-e09fec3373abcf836635dc33a95e9b9975058eb9.tar.bz2 minetest-e09fec3373abcf836635dc33a95e9b9975058eb9.zip |
New map directory structure that avoids map size being limited by filesystem
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 |