From f3aad05fc9064e70316dc2f1a4f7e22069a75f78 Mon Sep 17 00:00:00 2001 From: Dave Eddy Date: Thu, 3 Sep 2015 18:12:08 -0400 Subject: [PATCH] use mkdirp to create cache directories --- lib/cli.js | 3 ++- lib/triton.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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) {} }