Permalink
Browse files

Solved process.env issue in detector on certain version so linux.

  • Loading branch information...
1 parent b49f5fe commit 9e919c434b3db1a57d1f39d41105a62db64c0b00 @iammerrick iammerrick committed Oct 15, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/detector.js
View
14 lib/detector.js
@@ -19,14 +19,26 @@
*/
var detector = module.exports;
+var normalize = function(path) {
+ var last = Array.prototype.pop.apply(path);
+
+ if (process.platform !== "win32" && last !== '/') {
+ path += '/';
+ }
+
+ return path;
+}
+
/**
* Returns tmp dir. Thank you npm.
*
* @returns {String} tmp dir.
*/
detector.tmp = function() {
- return process.env.TMPDIR
+ var temp = process.env.TMPDIR
|| process.env.TMP
|| process.env.TEMP
|| (process.platform === "win32" ? "c:\\windows\\temp\\" : "/tmp/")
+
+ return normalize(temp);
};

0 comments on commit 9e919c4

Please sign in to comment.