diff --git a/lib/cli.js b/lib/cli.js index 60a661d..09576f5 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -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); } diff --git a/lib/triton.js b/lib/triton.js index 0938db9..39c4b87 100644 --- a/lib/triton.js +++ b/lib/triton.js @@ -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) {} }