Fix flow backup for first run, add tests

This commit is contained in:
Nick O'Leary
2014-05-07 00:33:50 +01:00
parent 0d6525623d
commit 7b0a1b2463
2 changed files with 79 additions and 1 deletions

View File

@@ -178,7 +178,9 @@ var localfilesystem = {
},
saveFlows: function(flows) {
fs.renameSync(flowsFullPath,flowsPrev);
if (fs.existsSync(flowsFullPath)) {
fs.renameSync(flowsFullPath,flowsPrev);
}
return nodeFn.call(fs.writeFile, flowsFullPath, JSON.stringify(flows));
},