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

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 29, 2013
1 parent 9bd9c54 commit 1167972
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
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
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
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 1167972

Please sign in to comment.