@@ -11,6 +11,7 @@ import { ipcRenderer, remote } from 'electron';
1111import { NewsDisplay } from './newsDisplay' ;
1212import { CommunityDisplay } from './communityDisplay' ;
1313import { InfoModal } from './infoModal' ;
14+ import { ConfigureModal } from './configureModal' ;
1415import { SettingsModal } from './settingsModal' ;
1516import { OnLaunchModal , OnLaunchModelStatus } from './onLaunchModal' ;
1617
@@ -64,7 +65,14 @@ export class App extends React.Component<AppProps, AppState> {
6465 window . addEventListener ( 'beforeunload' , this . componentCleanup ) ;
6566 if ( this . props . userDataPath ) {
6667 // Load config
67- const loadedConfig = await loadLauncherConfig ( `${ this . props . userDataPath } /launcherConfig.json` , this . props . userDataPath ) ;
68+ let loadedConfig = generateDefaultConfig ( ) ;
69+ try {
70+ loadedConfig = await loadLauncherConfig ( `${ this . props . userDataPath } /launcherConfig.json` , this . props . userDataPath ) ;
71+ } catch ( err ) {
72+ remote . dialog . showErrorBox ( 'Error loading configuration' ,
73+ `Unable to load launcher configuration; default configuration restored. Error: ${ err . message || err } ` ) ;
74+ }
75+
6876 this . setState ( ( s ) => ( {
6977 config : loadedConfig ,
7078 launcherState : s . launcherState ,
@@ -366,14 +374,20 @@ export class App extends React.Component<AppProps, AppState> {
366374 launcherVersion = { LAUNCHER_VERSION }
367375 onModalButtonClick = { ( pth ) => this . handleOnLaunchModelStateChange ( null , null , pth ) }
368376 />
377+ < ConfigureModal
378+ config = { this . state . config }
379+ news = { this . state . news }
380+ userDataPath = { this . props . userDataPath }
381+ userConfigPath = { this . props . userConfigPath }
382+ onUninstallComplete = { this . handleUninstallComplete }
383+ />
369384 < SettingsModal
370385 initialConfig = { this . state . config }
371386 onSettingsFormSave = { this . onSettingsFormSave }
372387 userDataPath = { this . props . userDataPath }
373388 userConfigPath = { this . props . userConfigPath }
374- onUninstallComplete = { this . handleUninstallComplete }
375389 />
376- < InfoModal launcherVersion = { LAUNCHER_VERSION } />
390+ < InfoModal launcherVersion = { LAUNCHER_VERSION } news = { this . state . news } />
377391 < Button compact size = { 'tiny' } icon onClick = { this . onBtnMinimisePressed } >
378392 < Icon fitted name = 'window minimize' />
379393 </ Button >
0 commit comments