summaryrefslogtreecommitdiff
path: root/src/subgame.cpp
diff options
context:
space:
mode:
authorPilzAdam <pilzadam@minetest.net>2013-08-13 19:15:06 +0200
committerPilzAdam <pilzadam@minetest.net>2013-08-13 22:05:45 +0200
commitd718b0b34eda84744778fa12a01d5be5f03753d3 (patch)
tree6ee450e7f1078a114c71f73ead16310f13bbc00c /src/subgame.cpp
parentc8930850e37dab9820049152a3e668a315a97560 (diff)
downloadminetest-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.cpp5
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;
}