|
|
@@ -233,6 +233,14 @@ BoardData.load = function loadBoard(name) {
|
|
233
|
233
|
console.error("Unable to read history from " + boardData.file + ". The following error occured: " + e);
|
|
234
|
234
|
log('empty board creation', { 'board': boardData.name });
|
|
235
|
235
|
boardData.board = {}
|
|
|
236
|
+ if (data) {
|
|
|
237
|
+ // There was an error loading the board, but some data was still read
|
|
|
238
|
+ var backupFileName = boardData.file + '.' + new Date().toISOString() + '.bak';
|
|
|
239
|
+ log("Writing the corrupted file to " + backupFileName);
|
|
|
240
|
+ fs.writeFile(backupFileName, data, function (err) {
|
|
|
241
|
+ if (err) log("Error writing " + backupFileName + ": " + err);
|
|
|
242
|
+ });
|
|
|
243
|
+ }
|
|
236
|
244
|
}
|
|
237
|
245
|
accept(boardData);
|
|
238
|
246
|
});
|