Merge pull request #10 from joyent/dave.eddy-1441318327
use mkdirp to create cache directories
This commit is contained in:
commit
edcc2a52ed
@ -12,6 +12,7 @@ var child_process = require('child_process'),
|
|||||||
var cmdln = require('cmdln'),
|
var cmdln = require('cmdln'),
|
||||||
Cmdln = cmdln.Cmdln;
|
Cmdln = cmdln.Cmdln;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var mkdirp = require('mkdirp');
|
||||||
var util = require('util'),
|
var util = require('util'),
|
||||||
format = util.format;
|
format = util.format;
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
@ -183,7 +184,7 @@ CLI.prototype.init = function (opts, args, callback) {
|
|||||||
|
|
||||||
if (!fs.existsSync(cacheDir)) {
|
if (!fs.existsSync(cacheDir)) {
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(cacheDir);
|
mkdirp.sync(cacheDir);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.info({err: e}, 'failed to make dir %s', cacheDir);
|
log.info({err: e}, 'failed to make dir %s', cacheDir);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ var auth = require('smartdc-auth');
|
|||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var format = require('util').format;
|
var format = require('util').format;
|
||||||
|
var mkdirp = require('mkdirp');
|
||||||
var once = require('once');
|
var once = require('once');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var restifyClients = require('restify-clients');
|
var restifyClients = require('restify-clients');
|
||||||
@ -73,7 +74,7 @@ function Triton(options) {
|
|||||||
this.cacheDir = path.join(options.cacheDir, slug);
|
this.cacheDir = path.join(options.cacheDir, slug);
|
||||||
this.log.trace({cacheDir: this.cacheDir}, 'cache dir');
|
this.log.trace({cacheDir: this.cacheDir}, 'cache dir');
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(this.cacheDir);
|
mkdirp.sync(this.cacheDir);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user