ELECTRON-1170 - Package dictionary files

This commit is contained in:
Kiran Niranjan 2019-04-25 11:32:20 +05:30
parent 2523241353
commit ecca7ecf54
7 changed files with 38 additions and 3 deletions

BIN
dictionaries/en-AU.bdic Normal file

Binary file not shown.

BIN
dictionaries/en-CA.bdic Normal file

Binary file not shown.

BIN
dictionaries/en-GB.bdic Normal file

Binary file not shown.

BIN
dictionaries/en-US.bdic Normal file

Binary file not shown.

BIN
dictionaries/fr-FR.bdic Normal file

Binary file not shown.

View File

@ -7,6 +7,8 @@ const crashReporter = electron.crashReporter;
const nodeURL = require('url');
const shellPath = require('shell-path');
const urlParser = require('url');
const { ncp } = require('ncp');
const path = require('path');
const nodePath = require('path');
require('electron-dl')();
@ -29,8 +31,8 @@ const getCmdLineArg = require('./utils/getCmdLineArg.js');
//setting the env path child_process issue https://github.com/electron/electron/issues/7688
shellPath()
.then((path) => {
process.env.PATH = path
.then((sPath) => {
process.env.PATH = sPath
})
.catch(() => {
process.env.PATH = [
@ -349,6 +351,7 @@ function setupFirstTimeLaunch(resolve, reject, shouldUpdateUserConfig) {
log.send(logLevels.INFO, 'setting first time launch config');
getConfigField('launchOnStartup')
.then(setStartup)
.then(copyDictionaries)
.then(() => {
if (shouldUpdateUserConfig) {
log.send(logLevels.INFO, `Resetting user config data? ${shouldUpdateUserConfig}`);
@ -359,6 +362,37 @@ function setupFirstTimeLaunch(resolve, reject, shouldUpdateUserConfig) {
.catch(reject);
}
/**
* Copies all the dictionaries files required
* for spellchecker module
* @return {Promise<any>}
*/
function copyDictionaries() {
return new Promise(resolve => {
if (isMac) {
resolve();
return;
}
const dictionariesDirName = 'dictionaries';
let dictionaryPath;
if (isDevEnv) {
dictionaryPath = path.join(app.getAppPath(), dictionariesDirName);
} else {
let execPath = path.dirname(app.getPath('exe'));
dictionaryPath = path.join(execPath, isMac ? '..' : '', dictionariesDirName);
}
const userDictionaries = path.join(app.getPath('userData'), dictionariesDirName);
ncp(dictionaryPath, userDictionaries, (error) => {
if (error) {
log.send(logLevels.ERROR, `unable to copy dictionaries ${error}`);
}
return resolve();
});
})
}
/**
* Sets Symphony on startup
* @param lStartup

View File

@ -36,6 +36,7 @@
"extraFiles": [
"config/Symphony.config",
"config/titleBarStyles.css",
"dictionaries/**",
"library/libsymphonysearch.dylib",
"library/cryptoLib.dylib",
"library/lz4.exec"
@ -100,7 +101,6 @@
"glob": "7.1.3",
"jest": "23.6.0",
"jest-html-reporter": "2.4.2",
"ncp": "2.0.0",
"robotjs": "0.5.1",
"selenium-webdriver": "3.6.0",
"wdio-selenium-standalone-service": "0.0.12"
@ -122,6 +122,7 @@
"lodash.isequal": "4.5.0",
"lodash.omit": "4.5.0",
"lodash.pick": "4.4.0",
"ncp": "2.0.0",
"node-osascript": "2.1.0",
"ref": "1.3.5",
"shell-path": "2.1.0",