Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

os: modify os.tmpdir() to judge more recommended order in windows #5083

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ exports.platform = function() {

exports.tmpdir = function() {
return process.env.TMPDIR ||
process.env.TMP ||
process.env.TEMP ||
(process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp');
process.env.TMP ||
(process.platform === 'win32' ? (process.env.systemroot || process.env.windir) + "\\temp" : '/tmp');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Long line.

Implementation: Casing? I thought it was SystemRoot and WinDir.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, windows doesn't care character case of env variables.
And standard expression is SystemRoot and windir

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384187(v=vs.85).aspx

I'll change code style and character cases, and request pull again.
It will be a different function on Windows entirely

Thanks

};

exports.tmpDir = exports.tmpdir;
Expand Down