Fix config overwrite

This commit is contained in:
Mattias Erming 2014-10-01 14:15:17 -07:00
parent fb61bdb1cb
commit 354dac6a52
3 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,9 @@
0.40.1 / 2014-10-01
==================
* Fix config overwrite
0.40.0 / 2014-10-01 0.40.0 / 2014-10-01
================== ==================

View File

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "The self-hosted web IRC client", "description": "The self-hosted web IRC client",
"version": "0.40.0", "version": "0.40.1",
"author": "Mattias Erming", "author": "Mattias Erming",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {

View File

@ -6,10 +6,10 @@ var child = require("child_process");
var Helper = require("../helper"); var Helper = require("../helper");
var CONFIG_PATH = process.env.SHOUT_CONFIG; var CONFIG_PATH = process.env.SHOUT_CONFIG;
if(!CONFIG_PATH) { if (!CONFIG_PATH) {
CONFIG_PATH = Helper.resolveHomePath("config.js"); CONFIG_PATH = Helper.resolveHomePath("config.js");
} }
if(!fs.exists(CONFIG_PATH)) { if (!fs.existsSync(CONFIG_PATH)) {
mkdirp.sync(Helper.getHomeDirectory()); mkdirp.sync(Helper.getHomeDirectory());
var configFile = fs.readFileSync(path.resolve(__dirname, "..", "..", "config.js")); var configFile = fs.readFileSync(path.resolve(__dirname, "..", "..", "config.js"));
fs.writeFileSync(CONFIG_PATH, configFile); fs.writeFileSync(CONFIG_PATH, configFile);