diff --git a/dictionaries/en-AU.bdic b/dictionaries/en-AU.bdic new file mode 100644 index 00000000..1f3216b0 Binary files /dev/null and b/dictionaries/en-AU.bdic differ diff --git a/dictionaries/en-CA.bdic b/dictionaries/en-CA.bdic new file mode 100644 index 00000000..21c1de6e Binary files /dev/null and b/dictionaries/en-CA.bdic differ diff --git a/dictionaries/en-GB.bdic b/dictionaries/en-GB.bdic new file mode 100644 index 00000000..5b8c5939 Binary files /dev/null and b/dictionaries/en-GB.bdic differ diff --git a/dictionaries/en-US.bdic b/dictionaries/en-US.bdic new file mode 100644 index 00000000..1129e149 Binary files /dev/null and b/dictionaries/en-US.bdic differ diff --git a/dictionaries/fr-FR.bdic b/dictionaries/fr-FR.bdic new file mode 100644 index 00000000..02bc1cdf Binary files /dev/null and b/dictionaries/fr-FR.bdic differ diff --git a/js/main.js b/js/main.js index e2d9d930..436cfbba 100644 --- a/js/main.js +++ b/js/main.js @@ -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} + */ +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 diff --git a/package.json b/package.json index 041ca271..122a08b0 100644 --- a/package.json +++ b/package.json @@ -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",