[Splash > QuickStart] New updater force init v2

This commit is contained in:
Ducko 2021-12-10 18:03:44 +00:00
parent 4ad38c5a77
commit 4ae0e48e98

View file

@ -332,6 +332,18 @@ function initSplash(startMinimized = false) {
if (process.env.OPENASAR_QUICKSTART || oaConfig.quickstart) setTimeout(() => { if (process.env.OPENASAR_QUICKSTART || oaConfig.quickstart) setTimeout(() => {
destroySplash(); destroySplash();
if (newUpdater !== null) { // Manually load desktop_core module path for faster requiring
const NodeModule = require('module');
const installDir = paths.getInstallPath();
const appDir = _fs.default.readdirSync(installDir).find((x) => x.startsWith('app-1')); // Find app dir by name
const modulesDir = _path.default.join(installDir, appDir, 'modules');
const moduleCoreDir = _fs.default.readdirSync(modulesDir).find((x) => x.startsWith('discord_desktop_core-')); // Find desktop core dir by name
NodeModule.globalPaths.push(_path.default.join(modulesDir, moduleCoreDir)); // Add to globalPaths for requiring
}
if (newUpdater != null) { if (newUpdater != null) {
updateUntilCurrent(); updateUntilCurrent();
} else { } else {
@ -344,7 +356,7 @@ function initSplash(startMinimized = false) {
setTimeout(() => { setTimeout(() => {
events.emit(APP_SHOULD_SHOW); events.emit(APP_SHOULD_SHOW);
}, 100); }, 100);
}, newUpdater != null ? 500 : 50); }, 50);
} }
function destroySplash() { function destroySplash() {