diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 8e241782..1a779095 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -8,7 +8,7 @@ const { Type } = require('helios-distribution-types') const os = require('os') const path = require('path') -const ConfigManager = require('./configmanager') +const ConfigManager = require('./configmanager') const logger = LoggerUtil.getLogger('ProcessBuilder') @@ -94,6 +94,21 @@ class ProcessBuilder { }) child.on('close', (code, signal) => { 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) => { if(err){ logger.warn('Error while deleting temp dir', err) diff --git a/app/assets/js/scripts/uicore.js b/app/assets/js/scripts/uicore.js index 02e9b5da..3d99c54b 100644 --- a/app/assets/js/scripts/uicore.js +++ b/app/assets/js/scripts/uicore.js @@ -5,16 +5,20 @@ * modules, excluding dependencies. */ // Requirements -const $ = require('jquery') -const {ipcRenderer, shell, webFrame} = require('electron') -const remote = require('@electron/remote') -const isDev = require('./assets/js/isdev') -const { LoggerUtil } = require('helios-core') -const Lang = require('./assets/js/langloader') +const $ = require('jquery') +const {ipcRenderer, shell, webFrame, clipboard} = require('electron') +const remote = require('@electron/remote') +const isDev = require('./assets/js/isdev') +const { LoggerUtil } = require('helios-core') +const Lang = require('./assets/js/langloader') const loggerUICore = LoggerUtil.getLogger('UICore') const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater') +function copy(value) { + clipboard.writeText(value, 'selection') +} + // Log deprecation and process warnings. process.traceProcessWarnings = true process.traceDeprecation = true diff --git a/app/assets/lang/en_US.toml b/app/assets/lang/en_US.toml index b9f64cfb..34c82fcc 100644 --- a/app/assets/lang/en_US.toml +++ b/app/assets/lang/en_US.toml @@ -218,6 +218,12 @@ joined = "Exploring the Realm!" [js.overlay] 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] executables = "Executables" allFiles = "All Files"