mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-21 19:22:13 -08:00
Compare commits
4 Commits
c7a0c75dca
...
d54b3c8dd6
Author | SHA1 | Date | |
---|---|---|---|
|
d54b3c8dd6 | ||
|
6aaeeff9a4 | ||
|
9cca37ca8a | ||
|
5a15cc1035 |
@ -8,7 +8,7 @@ const { Type } = require('helios-distribution-types')
|
|||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const ConfigManager = require('./configmanager')
|
const ConfigManager = require('./configmanager')
|
||||||
|
|
||||||
const logger = LoggerUtil.getLogger('ProcessBuilder')
|
const logger = LoggerUtil.getLogger('ProcessBuilder')
|
||||||
|
|
||||||
@ -94,6 +94,21 @@ class ProcessBuilder {
|
|||||||
})
|
})
|
||||||
child.on('close', (code, signal) => {
|
child.on('close', (code, signal) => {
|
||||||
logger.info('Exited with code', code)
|
logger.info('Exited with code', code)
|
||||||
|
if(code != 0){
|
||||||
|
setOverlayContent(
|
||||||
|
Lang.queryJS('processbuilder.exit.exitErrorHeader'),
|
||||||
|
Lang.queryJS('processbuilder.exit.message') + code,
|
||||||
|
Lang.queryJS('processbuilder.exit.copyCode')
|
||||||
|
)
|
||||||
|
setOverlayHandler(() => {
|
||||||
|
copy(Lang.queryJS('processbuilder.exit.copyCodeText') + code)
|
||||||
|
toggleOverlay(false)
|
||||||
|
})
|
||||||
|
setDismissHandler(() => {
|
||||||
|
toggleOverlay(false)
|
||||||
|
})
|
||||||
|
toggleOverlay(true, true)
|
||||||
|
}
|
||||||
fs.remove(tempNativePath, (err) => {
|
fs.remove(tempNativePath, (err) => {
|
||||||
if(err){
|
if(err){
|
||||||
logger.warn('Error while deleting temp dir', err)
|
logger.warn('Error while deleting temp dir', err)
|
||||||
@ -839,9 +854,7 @@ class ProcessBuilder {
|
|||||||
libs[mdl.getVersionlessMavenIdentifier()] = mdl.getPath()
|
libs[mdl.getVersionlessMavenIdentifier()] = mdl.getPath()
|
||||||
if(mdl.subModules.length > 0){
|
if(mdl.subModules.length > 0){
|
||||||
const res = this._resolveModuleLibraries(mdl)
|
const res = this._resolveModuleLibraries(mdl)
|
||||||
if(res.length > 0){
|
libs = {...libs, ...res}
|
||||||
libs = {...libs, ...res}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -850,9 +863,7 @@ class ProcessBuilder {
|
|||||||
for(let i=0; i<mods.length; i++){
|
for(let i=0; i<mods.length; i++){
|
||||||
if(mods.sub_modules != null){
|
if(mods.sub_modules != null){
|
||||||
const res = this._resolveModuleLibraries(mods[i])
|
const res = this._resolveModuleLibraries(mods[i])
|
||||||
if(res.length > 0){
|
libs = {...libs, ...res}
|
||||||
libs = {...libs, ...res}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,27 +874,25 @@ class ProcessBuilder {
|
|||||||
* Recursively resolve the path of each library required by this module.
|
* Recursively resolve the path of each library required by this module.
|
||||||
*
|
*
|
||||||
* @param {Object} mdl A module object from the server distro index.
|
* @param {Object} mdl A module object from the server distro index.
|
||||||
* @returns {Array.<string>} An array containing the paths of each library this module requires.
|
* @returns {{[id: string]: string}} An object containing the paths of each library this module requires.
|
||||||
*/
|
*/
|
||||||
_resolveModuleLibraries(mdl){
|
_resolveModuleLibraries(mdl){
|
||||||
if(!mdl.subModules.length > 0){
|
if(!mdl.subModules.length > 0){
|
||||||
return []
|
return {}
|
||||||
}
|
}
|
||||||
let libs = []
|
let libs = {}
|
||||||
for(let sm of mdl.subModules){
|
for(let sm of mdl.subModules){
|
||||||
if(sm.rawModule.type === Type.Library){
|
if(sm.rawModule.type === Type.Library){
|
||||||
|
|
||||||
if(sm.rawModule.classpath ?? true) {
|
if(sm.rawModule.classpath ?? true) {
|
||||||
libs.push(sm.getPath())
|
libs[sm.getVersionlessMavenIdentifier()] = sm.getPath()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If this module has submodules, we need to resolve the libraries for those.
|
// If this module has submodules, we need to resolve the libraries for those.
|
||||||
// To avoid unnecessary recursive calls, base case is checked here.
|
// To avoid unnecessary recursive calls, base case is checked here.
|
||||||
if(mdl.subModules.length > 0){
|
if(mdl.subModules.length > 0){
|
||||||
const res = this._resolveModuleLibraries(sm)
|
const res = this._resolveModuleLibraries(sm)
|
||||||
if(res.length > 0){
|
libs = {...libs, ...res}
|
||||||
libs = libs.concat(res)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return libs
|
return libs
|
||||||
|
@ -5,16 +5,20 @@
|
|||||||
* modules, excluding dependencies.
|
* modules, excluding dependencies.
|
||||||
*/
|
*/
|
||||||
// Requirements
|
// Requirements
|
||||||
const $ = require('jquery')
|
const $ = require('jquery')
|
||||||
const {ipcRenderer, shell, webFrame} = require('electron')
|
const {ipcRenderer, shell, webFrame, clipboard} = require('electron')
|
||||||
const remote = require('@electron/remote')
|
const remote = require('@electron/remote')
|
||||||
const isDev = require('./assets/js/isdev')
|
const isDev = require('./assets/js/isdev')
|
||||||
const { LoggerUtil } = require('helios-core')
|
const { LoggerUtil } = require('helios-core')
|
||||||
const Lang = require('./assets/js/langloader')
|
const Lang = require('./assets/js/langloader')
|
||||||
|
|
||||||
const loggerUICore = LoggerUtil.getLogger('UICore')
|
const loggerUICore = LoggerUtil.getLogger('UICore')
|
||||||
const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater')
|
const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater')
|
||||||
|
|
||||||
|
function copy(value) {
|
||||||
|
clipboard.writeText(value, 'selection')
|
||||||
|
}
|
||||||
|
|
||||||
// Log deprecation and process warnings.
|
// Log deprecation and process warnings.
|
||||||
process.traceProcessWarnings = true
|
process.traceProcessWarnings = true
|
||||||
process.traceDeprecation = true
|
process.traceDeprecation = true
|
||||||
|
@ -218,6 +218,12 @@ joined = "Exploring the Realm!"
|
|||||||
[js.overlay]
|
[js.overlay]
|
||||||
dismiss = "Dismiss"
|
dismiss = "Dismiss"
|
||||||
|
|
||||||
|
[js.processbuilder.exit]
|
||||||
|
exitErrorHeader = "Game exited with an error code"
|
||||||
|
message = "The game exited abnormally with the exited code: "
|
||||||
|
copyCode = "Copy exit code"
|
||||||
|
copyCodeText = "Minecraft exit code "
|
||||||
|
|
||||||
[js.settings.fileSelectors]
|
[js.settings.fileSelectors]
|
||||||
executables = "Executables"
|
executables = "Executables"
|
||||||
allFiles = "All Files"
|
allFiles = "All Files"
|
||||||
|
Loading…
Reference in New Issue
Block a user