Skip to content

Commit

Permalink
os: rename tmpDir() to tmpdir() for consistency
Browse files Browse the repository at this point in the history
Make the casing consistent with the other os.* functions but keep
os.tmpDir() around as an alias.
  • Loading branch information
bnoordhuis committed Jan 30, 2013
1 parent 60f18ed commit 3fe6aba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/api/os.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Provides a few basic operating-system related utility functions.

Use `require('os')` to access this module.

## os.tmpDir()
## os.tmpdir()

Returns the operating system's default directory for temp files.

Expand Down
4 changes: 3 additions & 1 deletion lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ exports.platform = function() {
return process.platform;
};

exports.tmpDir = function() {
exports.tmpdir = function() {
return process.env.TMPDIR ||
process.env.TMP ||
process.env.TEMP ||
(process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp');
};

exports.tmpDir = exports.tmpdir;

exports.getNetworkInterfaces = util.deprecate(function() {
return exports.networkInterfaces();
}, 'getNetworkInterfaces is now called `os.networkInterfaces`.');
Expand Down
8 changes: 4 additions & 4 deletions test/simple/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ process.env.TMPDIR = '/tmpdir';
process.env.TMP = '/tmp';
process.env.TEMP = '/temp';
var t = ( process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp' );
assert.equal(os.tmpDir(), '/tmpdir');
assert.equal(os.tmpdir(), '/tmpdir');
process.env.TMPDIR = '';
assert.equal(os.tmpDir(), '/tmp');
assert.equal(os.tmpdir(), '/tmp');
process.env.TMP = '';
assert.equal(os.tmpDir(), '/temp');
assert.equal(os.tmpdir(), '/temp');
process.env.TEMP = '';
assert.equal(os.tmpDir(), t);
assert.equal(os.tmpdir(), t);

var endianness = os.endianness();
console.log('endianness = %s', endianness);
Expand Down

0 comments on commit 3fe6aba

Please sign in to comment.