mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-11-10 06:17:44 +01:00
40 lines
740 B
JavaScript
40 lines
740 B
JavaScript
|
var path = require("path");
|
||
|
var mkdirp = require("mkdirp");
|
||
|
|
||
|
|
||
|
function genPath(subPath) {
|
||
|
subPath = subPath || ".";
|
||
|
var buildPath;
|
||
|
|
||
|
if(process.env.CIRCLE_ARTIFACTS) {
|
||
|
buildPath = path.join(process.env.CIRCLE_ARTIFACTS, subPath);
|
||
|
}
|
||
|
else {
|
||
|
buildPath = path.join(__dirname, '..', 'build', subPath);
|
||
|
}
|
||
|
|
||
|
return buildPath;
|
||
|
}
|
||
|
|
||
|
module.exports.path = function(subPath) {
|
||
|
var dirPath = genPath(subPath);
|
||
|
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
mkdirp(dirPath, function(err) {
|
||
|
if(err) {
|
||
|
reject(err);
|
||
|
}
|
||
|
else {
|
||
|
resolve(dirPath);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports.pathSync = function(subPath) {
|
||
|
var dirPath = genPath(subPath);
|
||
|
mkdirp.sync(dirPath);
|
||
|
return dirPath;
|
||
|
}
|
||
|
|