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

Merge pull request #3540 from hardillb/no-home-dir

Don't start if user has no home directory
This commit is contained in:
Nick O'Leary 2022-05-02 21:12:57 +01:00 committed by GitHub
commit a2de514c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,10 @@ if (parsedArgs.settings) {
// Consider compatibility for older versions
settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js");
} else {
if (!parsedArgs.userDir && !(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH)) {
console.log("Could not find user directory. Ensure $HOME is set for the current user, or use --userDir option")
process.exit(1)
}
var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red");
var userSettingsFile = path.join(userDir,"settings.js");
if (fs.existsSync(userSettingsFile)) {