use mkdirp to create cache directories

This commit is contained in:
Dave Eddy 2015-09-03 18:12:08 -04:00
parent 19ede6e489
commit f3aad05fc9
2 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@ var child_process = require('child_process'),
var cmdln = require('cmdln'),
Cmdln = cmdln.Cmdln;
var fs = require('fs');
var mkdirp = require('mkdirp');
var util = require('util'),
format = util.format;
var path = require('path');
@ -183,7 +184,7 @@ CLI.prototype.init = function (opts, args, callback) {
if (!fs.existsSync(cacheDir)) {
try {
fs.mkdirSync(cacheDir);
mkdirp.sync(cacheDir);
} catch (e) {
log.info({err: e}, 'failed to make dir %s', cacheDir);
}

View File

@ -10,6 +10,7 @@ var auth = require('smartdc-auth');
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var format = require('util').format;
var mkdirp = require('mkdirp');
var once = require('once');
var path = require('path');
var restifyClients = require('restify-clients');
@ -73,7 +74,7 @@ function Triton(options) {
this.cacheDir = path.join(options.cacheDir, slug);
this.log.trace({cacheDir: this.cacheDir}, 'cache dir');
try {
fs.mkdirSync(this.cacheDir);
mkdirp.sync(this.cacheDir);
} catch (e) {}
}