};
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;
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 = '';
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();