Permalink
Browse files

Use fs.existsSync if path.existsSync is deprecated

  • Loading branch information...
1 parent 8b3115a commit 3e4b961633c4eff5258d693c48dd139e697751e3 @brentlintner brentlintner committed Feb 28, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/cli.js
View
@@ -3,6 +3,11 @@ var fs = require('fs'),
argsparser = require('argsparser'),
hint = require('./hint');
+function existsSync() {
+ var obj = fs.existsSync ? fs : path;
+ return obj.existsSync.apply(obj, arguments);
+}
+
function _help() {
process.stdout.write(fs.readFileSync(__dirname + "/../HELP", "utf-8"));
}
@@ -19,7 +24,7 @@ function _removeJsComments(str) {
}
function _loadAndParseConfig(filePath) {
- return path.existsSync(filePath) ?
+ return existsSync(filePath) ?
JSON.parse(_removeJsComments(fs.readFileSync(filePath, "utf-8"))) : {};
}
@@ -121,7 +126,7 @@ module.exports = {
}
}
- if (path.existsSync(pathsToIgnore)) {
+ if (existsSync(pathsToIgnore)) {
ignore = fs.readFileSync(pathsToIgnore, "utf-8").split("\n").map(function (line) {
return line.trim();
}).filter(function (line) {

0 comments on commit 3e4b961

Please sign in to comment.