mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
2 Commits
3.1.5
...
Handle-Rea
Author | SHA1 | Date | |
---|---|---|---|
|
376db60acc | ||
|
ffa65afbb2 |
14
red.js
14
red.js
@@ -101,8 +101,18 @@ if (parsedArgs.settings) {
|
||||
var settingsStat = fs.statSync(defaultSettings);
|
||||
if (settingsStat.mtime.getTime() <= settingsStat.ctime.getTime()) {
|
||||
// Default settings file has not been modified - safe to copy
|
||||
fs.copySync(defaultSettings,userSettingsFile);
|
||||
settingsFile = userSettingsFile;
|
||||
try {
|
||||
fs.copySync(defaultSettings,userSettingsFile);
|
||||
settingsFile = userSettingsFile;
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Failed to copy settings file to "+userSettingsFile);
|
||||
console.log("Error: "+err.toString());
|
||||
if (err.code == "EACCES") {
|
||||
console.log("You may need to set readOnly: true, in settings.js");
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
// Use default settings.js as it has been modified
|
||||
settingsFile = defaultSettings;
|
||||
|
@@ -142,6 +142,7 @@
|
||||
"restore": "Restoring __type__ file backup : __path__",
|
||||
"restore-fail": "Restoring __type__ file backup failed : __message__",
|
||||
"fsync-fail": "Flushing file __path__ to disk failed : __message__",
|
||||
"fwrite-fail": "Writing backup file __path__ to disk failed : __message__",
|
||||
"projects": {
|
||||
"changing-project": "Setting active project : __project__",
|
||||
"active-project": "Active project : __project__",
|
||||
|
@@ -81,7 +81,11 @@ module.exports = {
|
||||
writeFile: function(path,content,backupPath) {
|
||||
if (backupPath) {
|
||||
if (fs.existsSync(path)) {
|
||||
fs.renameSync(path,backupPath);
|
||||
try {
|
||||
fs.renameSync(path,backupPath);
|
||||
} catch(e) {
|
||||
log.warn(log._("storage.localfilesystem.fwrite-fail",{path:path, message:e.toString()}));
|
||||
}
|
||||
}
|
||||
}
|
||||
return when.promise(function(resolve,reject) {
|
||||
|
Reference in New Issue
Block a user