mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
New map directory structure that avoids map size being limited by filesystem
This commit is contained in:
parent
f1bdc6b187
commit
e09fec3373
4 changed files with 111 additions and 47 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue