1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Dont write directly to files but rather write and copy a tmp file

This commit is contained in:
PilzAdam 2013-08-13 19:15:06 +02:00
parent c8930850e3
commit d718b0b34e
9 changed files with 101 additions and 69 deletions

View file

@ -241,8 +241,9 @@ bool initializeWorld(const std::string &path, const std::string &gameid)
if(!fs::PathExists(worldmt_path)){
infostream<<"Creating world.mt ("<<worldmt_path<<")"<<std::endl;
fs::CreateAllDirs(path);
std::ofstream of(worldmt_path.c_str(), std::ios::binary);
of<<"gameid = "<<gameid<<"\n";
std::ostringstream ss(std::ios_base::binary);
ss<<"gameid = "<<gameid<<"\n";
fs::safeWriteToFile(worldmt_path, ss.str());
}
return true;
}