1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Check file exists before trying to take backup

This commit is contained in:
Nick O'Leary 2020-09-11 13:26:00 +01:00
parent 4dd619b8c6
commit ef67b8481e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -80,7 +80,7 @@ module.exports = {
*/ */
writeFile: function(path,content,backupPath) { writeFile: function(path,content,backupPath) {
var backupPromise; var backupPromise;
if (backupPath) { if (backupPath && fs.existsSync(path)) {
backupPromise = fs.copy(path,backupPath); backupPromise = fs.copy(path,backupPath);
} else { } else {
backupPromise = Promise.resolve(); backupPromise = Promise.resolve();