forked from Mirrors/OpenAsar
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
const { join } = require('path');
|
|
const NodeModule = require('module');
|
|
const { app } = require('electron');
|
|
|
|
const log = require('./utils/log');
|
|
const requireNative = require('./utils/requireNative');
|
|
const paths = require('./paths');
|
|
const buildInfo = require('./utils/buildInfo');
|
|
|
|
// Just required for startup
|
|
const appSettings = require('./appSettings');
|
|
const GPUSettings = require('./GPUSettings');
|
|
const crashReporterSetup = require('./crashReporterSetup');
|
|
const splashScreen = require('./splash/splashScreen');
|
|
const Constants = require('./Constants');
|
|
const autoStart = require('./autoStart');
|
|
|
|
const updater = require('./updater/updater');
|
|
const moduleUpdater = require('./updater/moduleUpdater');
|
|
const appUpdater = require('./updater/appUpdater');
|
|
|
|
let desktopCore;
|
|
const startCore = () => {
|
|
desktopCore = requireNative('discord_desktop_core');
|
|
log('Bootstrap', 'Required desktop_core:', desktopCore);
|
|
|
|
desktopCore.startup({
|
|
paths,
|
|
splashScreen,
|
|
moduleUpdater,
|
|
autoStart,
|
|
buildInfo,
|
|
appSettings,
|
|
Constants,
|
|
GPUSettings,
|
|
updater,
|
|
crashReporterSetup
|
|
});
|
|
};
|
|
|
|
const startUpdate = () => {
|
|
appUpdater.update(false, () => {
|
|
startCore();
|
|
}, () => {
|
|
desktopCore.setMainWindowVisible(true);
|
|
});
|
|
};
|
|
|
|
module.exports = () => {
|
|
// Paths logging
|
|
log('Paths', `Init! Returns:
|
|
getUserData: ${paths.getUserData()}
|
|
getUserDataVersioned: ${paths.getUserDataVersioned()}
|
|
getResources: ${paths.getResources()}
|
|
getModuleDataPath: ${paths.getModuleDataPath()}
|
|
getInstallPath: ${paths.getInstallPath()}`);
|
|
|
|
if (app.isReady()) {
|
|
startUpdate();
|
|
} else {
|
|
app.once('ready', startUpdate);
|
|
}
|
|
}; |