From 3fe6aba558efe3f1cac17dd6c0c41fb11443788b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 29 Jan 2013 17:27:33 +0100 Subject: [PATCH] os: rename tmpDir() to tmpdir() for consistency Make the casing consistent with the other os.* functions but keep os.tmpDir() around as an alias. --- doc/api/os.markdown | 2 +- lib/os.js | 4 +++- test/simple/test-os.js | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/api/os.markdown b/doc/api/os.markdown index 3ef0d9282d..ae620e895c 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -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. diff --git a/lib/os.js b/lib/os.js index 612a0e43d5..673b7dd7d5 100644 --- a/lib/os.js +++ b/lib/os.js @@ -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`.'); diff --git a/test/simple/test-os.js b/test/simple/test-os.js index 59278329cc..79de1b14a4 100644 --- a/test/simple/test-os.js +++ b/test/simple/test-os.js @@ -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);