-
Notifications
You must be signed in to change notification settings - Fork 10
If none of these environmental variables exist; this will crash. #345
If none of these environmental variables exist; this will crash. #345
Conversation
…te a workable fallback.
return path.join(os.tmpdir(), tmp, "KillSwitches"); | ||
} else { | ||
return path.join(os.tmpdir(), "KillSwitches"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this equivalent to
var tmp = process.env.SUDO_USER || process.env.USER || process.env.USERNAME || "";
return path.join(os.tmpdir(), tmp, "KillSwitches");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I just tested path.join and your understanding is correct. I had expected path join to do two slashes in the middle of the path... I'll repush a commit.
Hello @NathanaelA, At any rate, in master this code is no longer used. |
…g realized it will not double up the slashes for a empty string.
Are you sure it isn't running. I just installed NativeScript yesterday and this code file is present on my box... |
the code is instantiated only on Windows - see d1230fa#diff-dc9cf03aafbce6404bc646fee9d733c0R82 You are correct that this code can potentially fail on Windows, though I believe it is highly unlike for USERNAME to miss on Windows. Maybe the correct fix is:
|
It is unlikely that it would now fail on windows; as username is set by the os and someone would have to actively remove it from the environment. But it might be worth doing the patch so that in the future if it is changed to be active on linux/osx it won't fail again. |
I agree. Thank you for your effort! |
If none of these environmental variables exist; this will crash.
Create a workable fallback.