Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use fs.exists* instead of deprecated path.exist*

This fixes #2.
  • Loading branch information...
commit 747af28caf5d7976edfcfa1d9a0d1ccc7ee52de7 1 parent 1198b8a
@npcode authored
Showing with 20 additions and 20 deletions.
  1. +2 −2 fsutil.js
  2. +18 −18 test/fsutil.test.js
View
4 fsutil.js
@@ -26,7 +26,7 @@ var _mkdir_p = function(path_segments) {
var paths_to_create = [];
if (!path_segments.every(function (segment) {
base = pth.join(base, segment);
- if (!pth.existsSync(base)) {
+ if (!fs.existsSync(base)) {
paths_to_create.push(base);
return true;
}
@@ -87,7 +87,7 @@ var cp_r = function(src, dst) {
}
var ln_sf = function(src, path) {
- if (pth.existsSync(path)) {
+ if (fs.existsSync(path)) {
if (fs.statSync(path).isDirectory()) {
var segments = src.split(pth.sep);
filename = segments.split(pth.sep)[segments.length - 1]
View
36 test/fsutil.test.js
@@ -5,19 +5,19 @@ var path = require('path');
suite('fsutil.rm_rf', function() {
setup(function(done) {
- if (path.existsSync('a')) {
+ if (fs.existsSync('a')) {
fs.rmdirSync('a');
}
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.unlinkSync('a/b');
}
- if (path.existsSync('b')) {
+ if (fs.existsSync('b')) {
fs.rmdirSync('b');
}
- if (path.existsSync('c')) {
+ if (fs.existsSync('c')) {
fs.unlinkSync('c');
}
- if (path.existsSync('d')) {
+ if (fs.existsSync('d')) {
fs.unlinkSync('d');
}
done();
@@ -27,8 +27,8 @@ suite('fsutil.rm_rf', function() {
fs.mkdirSync('a');
fs.writeFileSync('a/b', 'hello');
fsutil.rm_rf('a');
- assert.ok(!path.existsSync('a'));
- assert.ok(!path.existsSync('a/b'));
+ assert.ok(!fs.existsSync('a'));
+ assert.ok(!fs.existsSync('a/b'));
});
test('Remove a dead symbolic link.', function() {
@@ -40,19 +40,19 @@ suite('fsutil.rm_rf', function() {
});
teardown(function(done) {
- if (path.existsSync('a')) {
+ if (fs.existsSync('a')) {
fs.rmdirSync('a');
}
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.unlinkSync('a/b');
}
- if (path.existsSync('b')) {
+ if (fs.existsSync('b')) {
fs.rmdirSync('b');
}
- if (path.existsSync('c')) {
+ if (fs.existsSync('c')) {
fs.unlinkSync('c');
}
- if (path.existsSync('d')) {
+ if (fs.existsSync('d')) {
fs.unlinkSync('d');
}
done();
@@ -61,7 +61,7 @@ suite('fsutil.rm_rf', function() {
suite('fsutil.mkdir_p', function() {
setup(function(done) {
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.rmdirSync('a/b');
fs.rmdirSync('a');
}
@@ -70,13 +70,13 @@ suite('fsutil.mkdir_p', function() {
test('Create a directory and all its parent directories.', function(done) {
fsutil.mkdir_p('a/b');
- assert.ok(path.existsSync('a'));
- assert.ok(path.existsSync('a/b'));
+ assert.ok(fs.existsSync('a'));
+ assert.ok(fs.existsSync('a/b'));
done();
});
teardown(function(done) {
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.rmdirSync('a/b');
fs.rmdirSync('a');
}
@@ -86,7 +86,7 @@ suite('fsutil.mkdir_p', function() {
suite('fsutil.fwrite_p', function() {
setup(function(done) {
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.unlinkSync('a/b');
fs.rmdirSync('a');
}
@@ -100,7 +100,7 @@ suite('fsutil.fwrite_p', function() {
});
teardown(function(done) {
- if (path.existsSync('a/b')) {
+ if (fs.existsSync('a/b')) {
fs.unlinkSync('a/b');
fs.rmdirSync('a');
}

0 comments on commit 747af28

Please sign in to comment.
Something went wrong with that request. Please try again.