Skip to content

Commit

Permalink
Use mkdirp ≥ 1 (fixes tilemill-project#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Oct 22, 2020
1 parent 468dac9 commit 0c85547
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions lib/millstone.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,14 @@ function localize(url, options, callback) {
}
}
var dir_path = path.dirname(options.filepath);
mkdirp(dir_path, 0755, function(err) {
if (err && err.code !== 'EEXIST') {
mkdirp(dir_path, 0755).then(() => {
download(url, options, function(err, filepath) {
if (err) return callback(err);
callback(null, filepath);
});
})
.catch((err) => {
if ( err.code !== 'EEXIST') {
if (env == 'development') console.error('[millstone] could not create directory: ' + dir_path);
callback(err);
} else {
Expand Down Expand Up @@ -529,8 +535,9 @@ function resolve(options, callback) {
benchmark = options.benchmark;

Step(function setup() {
if (nosymlink) mkdirp(base, 0755, this);
else mkdirp(path.join(base, 'layers'), 0755, this);
var me = this;
if (nosymlink) mkdirp(base, 0755).then(() => {me()}).catch((e)=>{me(e)});
else mkdirp(path.join(base, 'layers'), 0755).then(() => {me()}).catch((e)=>{me(e)});
}, function style_externals(err) {
if (err && err.code !== 'EEXIST') throw err;
if (benchmark) console.time("[millstone][benchmark] Resolving style (mss) externals");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"zipfile": "~0.5.5",
"sqlite3": "4.1.0",
"mime": "~1.2.11",
"mkdirp": "~0.5.0",
"mkdirp": "^1.0.3",
"optimist": "~0.6.1"
},
"devDependencies": {
Expand Down

0 comments on commit 0c85547

Please sign in to comment.