electron-113: fixes the issues raised by qa.

This commit is contained in:
Vishwas Shashidhar 2017-09-05 11:26:42 +05:30
parent 35177567ce
commit 55c3714b2b
2 changed files with 7 additions and 45 deletions

View File

@ -349,13 +349,17 @@ function clearCachedConfigs() {
}
module.exports = {
getConfigField,
updateConfigField,
configFileName,
getConfigField,
updateConfigField,
updateUserConfigWin,
updateUserConfigMac,
// items below here are only exported for testing, do NOT use!
saveUserConfig,
clearCachedConfigs
};

View File

@ -8,13 +8,8 @@ const squirrelStartup = require('electron-squirrel-startup');
const AutoLaunch = require('auto-launch');
const urlParser = require('url');
const childProcess = require('child_process');
const path = require('path');
const AppDirectory = require('appdirectory');
const dirs = new AppDirectory('Symphony');
// Local Dependencies
const { getConfigField } = require('./config.js');
const {getConfigField, updateUserConfigWin, updateUserConfigMac} = require('./config.js');
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
@ -178,43 +173,6 @@ function setStartup(lStartup) {
});
}
/**
* Method to overwrite user config on mac installer
* @returns {Promise}
*/
function updateUserConfigMac() {
return new Promise((resolve, reject) => {
let userConfigPath = dirs.userConfig() + '/';
let globalConfigPath = process.argv[2];
let userName = process.env.USER;
childProcess.exec(`rsync -r "${globalConfigPath}" "${userConfigPath}" && chown -R "${userName}" "${userConfigPath}"`, {timeout: 60000}, (err) => {
if (err) {
reject(err);
}
resolve();
});
});
}
/**
* Method to overwrite user config on windows installer
* @returns {Promise}
*/
function updateUserConfigWin() {
return new Promise((resolve, reject) => {
let userConfigPath = app.getPath('userData');
let globalConfigPath = path.join(__dirname, '..', '..', '..', 'config/Symphony.config');
childProcess.exec(`echo D|xcopy /y /e /s /c "${globalConfigPath}" "${userConfigPath}"`, {timeout: 60000}, (err) => {
if (err) {
reject(err);
}
resolve();
});
});
}
/**
* Checks for the url argument, processes it
* and creates the main window