From 3d47f494a8ade53195814a0c05b73460b846a0b0 Mon Sep 17 00:00:00 2001 From: Jonas Hermsmeier Date: Mon, 28 May 2018 16:35:09 +0200 Subject: [PATCH] fix(app): Fix config path on Windows, typos --- lib/gui/app/models/local-settings.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/lib/gui/app/models/local-settings.js b/lib/gui/app/models/local-settings.js index ae9eceaa..3405b5fc 100644 --- a/lib/gui/app/models/local-settings.js +++ b/lib/gui/app/models/local-settings.js @@ -41,24 +41,15 @@ const JSON_INDENT = 2 */ const USER_DATA_DIR = electron.remote.app.getPath('userData') -/** - * @summary Local settings filename - * @constant - * @type {String} - */ -const RCFILE = '.etcher.json' - /** * @summary Configuration file path * @type {String} * @constant */ -const HOME_CONFIG_PATH = process.platform === 'win32' - ? path.join(USER_DATA_DIR, RCFILE) - : path.join(USER_DATA_DIR, 'config.json') +const CONFIG_PATH = path.join(USER_DATA_DIR, 'config.json') /** - * @summary Read a local .etcherrc file + * @summary Read a local config.json file * @function * @private * @@ -67,7 +58,7 @@ const HOME_CONFIG_PATH = process.platform === 'win32' * @returns {Promise} * * @example - * readConfigFile('.etcherrc').then((settings) => { + * readConfigFile('config.json').then((settings) => { * console.log(settings) * }) */ @@ -88,7 +79,7 @@ const readConfigFile = (filename) => { } /** - * @summary Read a local .etcherrc file + * @summary Write to the local configuration file * @function * @private * @@ -98,7 +89,7 @@ const readConfigFile = (filename) => { * @returns {Promise} * * @example - * writeConfigFile('.etcherrc', { something: 'good' }) + * writeConfigFile('config.json', { something: 'good' }) * .then(() => { * console.log('data written') * }) @@ -130,7 +121,7 @@ const writeConfigFile = (filename, data) => { * }); */ exports.readAll = () => { - return readConfigFile(HOME_CONFIG_PATH) + return readConfigFile(CONFIG_PATH) } /** @@ -150,7 +141,7 @@ exports.readAll = () => { * }); */ exports.writeAll = (settings) => { - return writeConfigFile(HOME_CONFIG_PATH, settings) + return writeConfigFile(CONFIG_PATH, settings) } /** @@ -170,7 +161,7 @@ exports.writeAll = (settings) => { */ exports.clear = () => { return new Bluebird((resolve, reject) => { - fs.unlink(HOME_CONFIG_PATH, (error) => { + fs.unlink(CONFIG_PATH, (error) => { if (error) { reject(error) } else {