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
1 changed files with 1 additions and 1 deletions

View File

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