Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
use rimraf for windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer authored and florianf committed Apr 22, 2016
1 parent c068068 commit b444905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
27 changes: 1 addition & 26 deletions lib/fsutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var path = require('path');
var constants = require('constants');
var _ = require('underscore');
var mkdirp = require('mkdirp');
var rm = require('rimraf');
// node v6 -> v8 compatibility
var existsSync = require('fs').existsSync || require('path').existsSync;

Expand Down Expand Up @@ -50,32 +51,6 @@ function readdir(filepath, callback) {
});
};


// Recursive rm.
function rm(filepath, callback) {
var killswitch = false;
fs.lstat(filepath, function(err, stat) {
if (err) return callback(err);
if (stat.isFile() || stat.isSymbolicLink()) return fs.unlink(filepath, callback);
if (!stat.isDirectory()) return callback(new Error('Unrecognized file.'));
Step(function() {
fs.readdir(filepath, this);
},
function(err, files) {
if (err) throw err;
if (files.length === 0) return this(null, []);
var group = this.group();
_(files).each(function(file) {
rm(path.join(filepath, file), group());
});
},
function(err) {
if (err) return callback(err);
fs.rmdir(filepath, callback);
});
});
};

// Utility function. Implements a `cp -r` like method in node.
function cprSync(from, to) {
var stat = fs.lstatSync(from);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"JSV": "4.0.x",
"sax": "0.6.x",
"request": "2.x",
"rimraf": "^2.5.2",
"step": "~0.0.5",
"mbtiles": "~0.8.2",
"mapnik": "3.5.13",
Expand Down

0 comments on commit b444905

Please sign in to comment.