Electron-308

1. Changed args name
2. Fixed copy config method
This commit is contained in:
Kiran Niranjan 2018-02-20 14:50:21 +05:30 committed by kiranniranjan
parent a07ac4ed8a
commit 20c3368272
5 changed files with 18 additions and 9 deletions

View File

@ -34,8 +34,8 @@ describe('Tests for Always on top', () => {
return require('electron').remote.app.getPath('userData'); return require('electron').remote.app.getPath('userData');
}) })
}); });
app.client.getUserDataPath().then((path) => { app.client.getUserDataPath().then((userConfigPath) => {
resolve(path.value + '/Symphony.config') resolve(userConfigPath.value + '/Symphony.config')
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);
}); });

View File

@ -37,8 +37,8 @@ describe('Tests for Full screen', () => {
return require('electron').remote.app.getPath('userData'); return require('electron').remote.app.getPath('userData');
}) })
}); });
app.client.getUserDataPath().then((path) => { app.client.getUserDataPath().then((userConfigPath) => {
resolve(path.value + '/Symphony.config') resolve(userConfigPath.value + '/Symphony.config')
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);
}); });

View File

@ -37,8 +37,8 @@ describe('Tests for Minimize on Close', () => {
return require('electron').remote.app.getPath('userData'); return require('electron').remote.app.getPath('userData');
}) })
}); });
app.client.getUserDataPath().then((path) => { app.client.getUserDataPath().then((userConfigPath) => {
resolve(path.value + '/Symphony.config') resolve(userConfigPath.value + '/Symphony.config')
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);
}); });

View File

@ -44,7 +44,16 @@ class App {
static readConfig(configPath) { static readConfig(configPath) {
if (!fs.existsSync(configPath)) { if (!fs.existsSync(configPath)) {
return this.copyConfigPath(); return new Promise(function (resolve) {
this.copyConfigPath().then(() => {
fs.readFile(configPath, 'utf-8', function (err, data) {
if (err) {
throw new Error("Unable to read user config file " + err);
}
resolve(JSON.parse(data));
});
});
});
} }
return new Promise(function (resolve) { return new Promise(function (resolve) {

View File

@ -37,8 +37,8 @@ describe('Tests for Zoom in and Zoom out', () => {
return require('electron').remote.app.getPath('userData'); return require('electron').remote.app.getPath('userData');
}) })
}); });
app.client.getUserDataPath().then((path) => { app.client.getUserDataPath().then((userConfigPath) => {
resolve(path.value + '/Symphony.config') resolve(userConfigPath.value + '/Symphony.config')
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);
}); });