修复启动错误.
This commit is contained in:
parent
4e6206eee9
commit
0a3b6a331d
|
@ -107,9 +107,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} userDataPath
|
* @param {string} userDataPath
|
||||||
|
* @param {string} locale
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
function getLanguagePackConfigurations(userDataPath) {
|
function getLanguagePackConfigurations(userDataPath, locale) {
|
||||||
const configFile = path.join(userDataPath, 'languagepacks.json');
|
const configFile = path.join(userDataPath, 'languagepacks.json');
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(configFile)) {
|
if (!fs.existsSync(configFile)) {
|
||||||
|
@ -119,7 +120,7 @@
|
||||||
} else {
|
} else {
|
||||||
let config = nodeRequire(configFile);
|
let config = nodeRequire(configFile);
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return nodeRequire(configFile)
|
return nodeRequire(configFile);
|
||||||
}
|
}
|
||||||
locale = resolveLanguagePackLocale(config, locale);
|
locale = resolveLanguagePackLocale(config, locale);
|
||||||
if (!locale) {
|
if (!locale) {
|
||||||
|
@ -129,7 +130,7 @@
|
||||||
if (!packConfig || typeof packConfig.hash !== 'string') {
|
if (!packConfig || typeof packConfig.hash !== 'string') {
|
||||||
return nodeRequire(configFile);
|
return nodeRequire(configFile);
|
||||||
}
|
}
|
||||||
if (packConfig.hash != 'd40608d6c84271a3245f89217f02df0a' && locale === 'zh-cn') {
|
if (packConfig.hash !== 'd40608d6c84271a3245f89217f02df0a' && locale === 'zh-cn') {
|
||||||
let languagePack = generateLanguagePacks();
|
let languagePack = generateLanguagePacks();
|
||||||
return languagePack;
|
return languagePack;
|
||||||
}
|
}
|
||||||
|
@ -139,6 +140,7 @@
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Do nothing. If we can't read the file we have no
|
// Do nothing. If we can't read the file we have no
|
||||||
// language pack config.
|
// language pack config.
|
||||||
|
console.log('getLanguagePackConfigurations error:' + err);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +205,7 @@
|
||||||
if (!commit) {
|
if (!commit) {
|
||||||
return defaultResult(initialLocale);
|
return defaultResult(initialLocale);
|
||||||
}
|
}
|
||||||
const configs = getLanguagePackConfigurations(userDataPath);
|
const configs = getLanguagePackConfigurations(userDataPath, locale);
|
||||||
if (!configs) {
|
if (!configs) {
|
||||||
return defaultResult(initialLocale);
|
return defaultResult(initialLocale);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue