Permalink
Browse files

fix: `existsSync` moved from `path` module to `fs` module

  • Loading branch information...
1 parent 8b4fc09 commit 8164e876061e5350dc023e83dd837cb5283f389a @qiao committed Jul 3, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 bin/mdwatch.js
View
@@ -1,14 +1,20 @@
#!/usr/bin/env node
-var path = require('path');
var mdwatch = require('../');
+var existsSync;
+if (process.version.indexOf('v0.8') === 0) {
+ existsSync = require('fs').existsSync;
+} else {
+ existsSync = require('path').existsSync;
+}
+
function usage(mes) {
if (mes) {
console.log(mes + '\n');
}
- lines = [
- 'Usage: ',
+ var lines = [
+ 'Usage: ',
' mdwatch [-pch] file ',
' ',
'Options: ',
@@ -63,7 +69,7 @@ function main(argv) {
usage();
process.exit(0);
}
- if (!path.existsSync(file)) {
+ if (!existsSync(file)) {
usage('File not exists: ' + file);
process.exit(1);
}

0 comments on commit 8164e87

Please sign in to comment.