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

fix(windows): fix tempDir on windows #51

Merged
merged 1 commit into from May 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 1 addition & 20 deletions lib/tmp.js
Expand Up @@ -16,7 +16,7 @@ var
crypto = require('crypto'),
exists = fs.exists || path.exists,
existsSync = fs.existsSync || path.existsSync,
tmpDir = os.tmpDir || _getTMPDir,
tmpDir = require('os-tmpdir'),
_c = require('constants');


Expand Down Expand Up @@ -72,25 +72,6 @@ function _randomChars(howMany) {
return value.join('');
}

/**
* Gets the temp directory.
*
* @return {String}
* @api private
*/
function _getTMPDir() {
var tmpNames = ['TMPDIR', 'TMP', 'TEMP'];

for (var i = 0, length = tmpNames.length; i < length; i++) {
if (_isUndefined(process.env[tmpNames[i]])) continue;

return process.env[tmpNames[i]];
}

// fallback to the default
return '/tmp';
}

/**
* Checks whether the `obj` parameter is defined or not.
*
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -33,7 +33,9 @@
"node": ">=0.4.0"
},

"dependencies": {},
"dependencies": {
"os-tmpdir": "~1.0.0"
},

"devDependencies": {
"vows": "~0.7.0"
Expand Down