summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2014-09-30 20:16:20 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2014-09-30 20:16:20 +0100
commitc6951b66d25b92e9d354db8ff05ed55089e24583 (patch)
treeeabeb559eedd083a04f31eec826eaa8e7d8784ee /lib
parent4179bf6bdac360a78368c5d3264b27426e41a42d (diff)
downloadmongo-edu-c6951b66d25b92e9d354db8ff05ed55089e24583.zip
save in data dir
Diffstat (limited to 'lib')
-rw-r--r--lib/options.js13
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) {