mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix ENOENT error on first start when no user dir (#1711)
* Fix ENOENT error on first start when no user dir Write backup using `copySync` and move it below the `fsync` to ensure file is present when backup is made. * Check for path to exist before attempting backup
This commit is contained in:
parent
53e3e08d70
commit
6fa0d671c0
@ -80,10 +80,8 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
writeFile: function(path,content,backupPath) {
|
writeFile: function(path,content,backupPath) {
|
||||||
if (backupPath) {
|
if (backupPath) {
|
||||||
try {
|
if (fs.existsSync(path)) {
|
||||||
fs.renameSync(path,backupPath);
|
fs.renameSync(path,backupPath);
|
||||||
} catch(err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return when.promise(function(resolve,reject) {
|
return when.promise(function(resolve,reject) {
|
||||||
|
Loading…
Reference in New Issue
Block a user