智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/32/328e282d24fa348cd4b789a994a...

38 lines
872 B

const isFn = require('./isFn');
const noop = require('./noop');
const fs = require('fs');
const path = require('path');
const _0777 = parseInt('0777', 8);
exports = function(p, mode, cb) {
if (isFn(mode)) {
cb = mode;
mode = _0777;
}
cb = cb || noop;
p = path.resolve(p);
fs.mkdir(p, mode, function(err) {
if (!err) return cb();
switch (err.code) {
case 'ENOENT':
exports(path.dirname(p), mode, function(err) {
if (err) return cb(err);
exports(p, mode, cb);
});
break;
default:
fs.stat(p, function(errStat, stat) {
if (errStat || !stat.isDirectory()) return cb(errStat);
cb();
});
}
});
};
module.exports = exports;