summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/options.js13
-rw-r--r--package.json3
2 files changed, 14 insertions, 2 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) {
diff --git a/package.json b/package.json
index ff634df..073d346 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "mongo-edu",
"preferGlobal": true,
- "version": "0.1.60",
+ "version": "0.1.50",
"author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)",
"description": "Select and download videos and handouts from university.mongodb.com courses",
"main": "./mongo-edu",
@@ -39,6 +39,7 @@
"lodash": "~2.4.1",
"mkdirp": "~0.5.0",
"mv": "~2.0.3",
+ "path-extra": "~0.3.0",
"progress": "~1.1.8",
"request": "~2.42.0",
"request-progress": "~0.3.1",