Permalink
Browse files

Use Solaris friendly tmp file names

  • Loading branch information...
1 parent adb8818 commit bac4c898dabd7719e232a49a4e9c57011b26631e @creationix committed Aug 26, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/world-db.js
View
@@ -233,7 +233,7 @@ function worldDB(filename, tileSize, saveInterval) {
// Get a consistent snapshot of the entire db
var data = snapshot();
- var stream = fs.createWriteStream('~' + filename);
+ var stream = fs.createWriteStream(filename + ".tmp");
stream.addListener('close', this.parallel());
stream.write(JSON.stringify(data.meta) + "\n", 'utf8');
data.buffers.forEach(function (buffer) {
@@ -247,7 +247,7 @@ function worldDB(filename, tileSize, saveInterval) {
fs.unlink(filename, this);
},
function moveFileIn(err) {
- fs.rename('~' + filename, filename, this);
+ fs.rename(filename + ".tmp", filename, this);
},
callback
);
@@ -305,4 +305,4 @@ function worldDB(filename, tileSize, saveInterval) {
};
-module.exports = worldDB;
+module.exports = worldDB;

0 comments on commit bac4c89

Please sign in to comment.