diff options
author | PilzAdam <pilzadam@minetest.net> | 2013-08-13 19:15:06 +0200 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-08-13 22:05:45 +0200 |
commit | d718b0b34eda84744778fa12a01d5be5f03753d3 (patch) | |
tree | 6ee450e7f1078a114c71f73ead16310f13bbc00c /src/subgame.cpp | |
parent | c8930850e37dab9820049152a3e668a315a97560 (diff) | |
download | minetest-d718b0b34eda84744778fa12a01d5be5f03753d3.tar.gz minetest-d718b0b34eda84744778fa12a01d5be5f03753d3.tar.bz2 minetest-d718b0b34eda84744778fa12a01d5be5f03753d3.zip |
Dont write directly to files but rather write and copy a tmp file
Diffstat (limited to 'src/subgame.cpp')
-rw-r--r-- | src/subgame.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/subgame.cpp b/src/subgame.cpp index 7fee3899d..806d65934 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -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; } |