Permalink
Browse files

Not using fs.existsSync if possible

  • Loading branch information...
1 parent e8ef61d commit 565a03cf3090ec3964dbc8ffd82942352fde7016 @curvedmark committed Mar 26, 2013
Showing with 5 additions and 9 deletions.
  1. +1 −2 bin/roole
  2. +4 −7 test/assert.js
View
@@ -3,7 +3,6 @@
var fs = require('fs');
var path = require('path');
-var existsSync = fs.existsSync || path.existsSync;
var mkdirp = require('mkdirp');
var program = require('commander');
var roole = require('../lib/roole');
@@ -152,7 +151,7 @@ function writeFile(file, watching) {
}
} else {
var dir = path.dirname(file.outputName);
- if (!existsSync(dir)) { mkdirp.sync(dir); }
+ mkdirp.sync(dir);
fs.writeFileSync(file.outputName, file.compiledContent);
if (program.watch && watching) {
View
@@ -3,7 +3,6 @@
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
-var existsSync = fs.existsSync || path.existsSync;
var mkdirp = require('mkdirp');
var roole = require('../lib/roole');
var assert = exports;
@@ -106,10 +105,10 @@ assert.failAt = function(options, input, loc) {
};
assert.run = function(cmd, input, output) {
+ var existsSync = fs.existsSync || path.existsSync;
+
var dir = 'test-dir';
- if (!existsSync(dir)) {
- mkdirp.sync(dir);
- }
+ mkdirp.sync(dir);
if (Array.isArray(input.stdin)) {
input.stdin = input.stdin.join('\n');
@@ -132,9 +131,7 @@ assert.run = function(cmd, input, output) {
}
var fileDir = path.dirname(filename);
- if (!existsSync(fileDir)) {
- mkdirp.sync(fileDir);
- }
+ mkdirp.sync(fileDir);
if (Array.isArray(fileContent)) {
fileContent = fileContent.join('\n');

0 comments on commit 565a03c

Please sign in to comment.