Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: remove trailing slash from os.tmpdir() #747

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ exports.platform = function() {
};

exports.tmpdir = function() {
var path;
if (isWindows) {
return process.env.TEMP ||
path = process.env.TEMP ||
process.env.TMP ||
(process.env.SystemRoot || process.env.windir) + '\\temp';
} else {
return process.env.TMPDIR ||
path = process.env.TMPDIR ||
process.env.TMP ||
process.env.TEMP ||
'/tmp';
}
if (/[\\\/]$/.test(path))
path = path.slice(0, -1);
return path;
};

exports.tmpDir = exports.tmpdir;
Expand Down
8 changes: 4 additions & 4 deletions src/node_version.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef SRC_NODE_VERSION_H_
#define SRC_NODE_VERSION_H_

#define NODE_MAJOR_VERSION 1
#define NODE_MINOR_VERSION 6
#define NODE_PATCH_VERSION 2
#define NODE_MAJOR_VERSION 2
#define NODE_MINOR_VERSION 0
#define NODE_PATCH_VERSION 0

#define NODE_VERSION_IS_RELEASE 0

Expand Down Expand Up @@ -45,6 +45,6 @@
* an API is broken in the C++ side, including in v8 or
* other dependencies.
*/
#define NODE_MODULE_VERSION 43 /* io.js v1.1.0 */
#define NODE_MODULE_VERSION 44 /* io.js v2.x */

#endif /* SRC_NODE_VERSION_H_ */
4 changes: 4 additions & 0 deletions test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if (process.platform === 'win32') {
process.env.TMP = '';
var expected = (process.env.SystemRoot || process.env.windir) + '\\temp';
assert.equal(os.tmpdir(), expected);
process.env.TEMP = '\\temp\\';
assert.equal(os.tmpdir(), '\\temp');
} else {
assert.equal(os.tmpdir(), '/tmpdir');
process.env.TMPDIR = '';
Expand All @@ -21,6 +23,8 @@ if (process.platform === 'win32') {
assert.equal(os.tmpdir(), '/temp');
process.env.TEMP = '';
assert.equal(os.tmpdir(), '/tmp');
process.env.TMPDIR = '/tmpdir/';
assert.equal(os.tmpdir(), '/tmpdir');
}

var endianness = os.endianness();
Expand Down