From 44e8103b3d2d7e5f46df5b9ed7dd72368f4a21a9 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Mon, 11 Sep 2017 17:17:44 +0530 Subject: [PATCH] electron-126: supported pretty printing on writing user config --- js/config.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/config.js b/js/config.js index 9d4fe7ae..945f4010 100644 --- a/js/config.js +++ b/js/config.js @@ -217,11 +217,11 @@ function saveUserConfig(fieldName, newValue, oldConfig) { } /** - * Clears the existing user config settings including + * Updates the existing user config settings by removing * 'minimizeOnClose', 'launchOnStartup', 'url' and 'alwaysOnTop' * @param {Object} oldUserConfig the old user config object */ -function clearUserConfig(oldUserConfig) { +function updateUserConfig(oldUserConfig) { return new Promise((resolve) => { @@ -229,7 +229,7 @@ function clearUserConfig(oldUserConfig) { // by ommitting the user related settings from // the old user config let newUserConfig = omit(oldUserConfig, ignoreSettings); - let newUserConfigString = JSON.stringify(newUserConfig); + let newUserConfigString = JSON.stringify(newUserConfig, null, 4); // get the user config path let userConfigFile; @@ -273,7 +273,7 @@ function updateUserConfigWin(perUserInstall) { // https://perzoinc.atlassian.net/browse/ELECTRON-126 Promise.all([readUserConfig(userConfigFile)]) .then((data) => { - resolve(clearUserConfig(data[0])); + resolve(updateUserConfig(data[0])); }) .catch((err) => { reject(err); @@ -305,7 +305,7 @@ function updateUserConfigMac() { // https://perzoinc.atlassian.net/browse/ELECTRON-126 Promise.all([readUserConfig(userConfigFile)]) .then((data) => { - resolve(clearUserConfig(data[0])); + resolve(updateUserConfig(data[0])); }) .catch((err) => { reject(err);