diff options
Diffstat (limited to 'lib/options.js')
-rw-r--r-- | lib/options.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/options.js b/lib/options.js index 0e95a2d..614cb25 100644 --- a/lib/options.js +++ b/lib/options.js @@ -11,7 +11,10 @@ var fs = require('fs'), _ = require('lodash'), inquirer = require('inquirer'), Table = require('easy-table'), + mkdirp = require('mkdirp'), + pathEx = require('path-extra'), prompts = require('./prompts'), + pkg = require('../package'), yargs = require('yargs') .usage('Usage: $0 [options]') .describe('d', 'download path').describe('u', 'email address') @@ -40,7 +43,15 @@ var fs = require('fs'), .demand('d'); var base = {}, - optionsPath = path.join(__dirname, '..', '/bin/args.json'); + dataPath = pathEx.datadir(pkg.name), + optionsPath = dataPath + '/args.json'; + +mkdirp(dataPath, function mkdirp(err) { + + 'use strict'; + + if (err !== null) { return console.log('i'.red + ' Unable to Create Data Directory: ' + err.stack); } +}); function readFromPath(callback) { |