From e09fec3373abcf836635dc33a95e9b9975058eb9 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Wed, 18 May 2011 16:48:27 +0100 Subject: New map directory structure that avoids map size being limited by filesystem --- src/filesys.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/filesys.cpp') 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 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 -- cgit v1.2.3