Fix failing to launch on missing arg

This commit is contained in:
Thoronium
2023-11-25 14:54:35 -07:00
parent 27148eac8e
commit 572006ff95

View File

@@ -179,33 +179,38 @@ export class Main extends React.Component<IProps, IState> {
const updatedConfig = await getConfigOption('patch_rsa') const updatedConfig = await getConfigOption('patch_rsa')
await setConfigOption('patch_rsa', updatedConfig) await setConfigOption('patch_rsa', updatedConfig)
// Get latest version and compare to this version // Update launch args to allow launching when updating from old versions
const latestVersion: { await setConfigOption('launch_args', await getConfigOption('launch_args'))
tag_name: string
link: string
} = await invoke('get_latest_release')
const tagName = latestVersion?.tag_name.replace(/[^\d.]/g, '')
// Check if tagName is different than current version if (!(await getConfigOption('offline_mode'))) {
if (tagName && tagName !== (await getVersion())) { // Get latest version and compare to this version
// Display notification of new release const latestVersion: {
this.setState({ tag_name: string
notification: ( link: string
<> } = await invoke('get_latest_release')
Cultivation{' '} const tagName = latestVersion?.tag_name.replace(/[^\d.]/g, '')
<a href="#" onClick={() => invoke('open_in_browser', { url: latestVersion.link })}>
{latestVersion?.tag_name}
</a>{' '}
is now available!
</>
),
})
setTimeout(() => { // Check if tagName is different than current version
if (tagName && tagName !== (await getVersion())) {
// Display notification of new release
this.setState({ this.setState({
notification: null, notification: (
<>
Cultivation{' '}
<a href="#" onClick={() => invoke('open_in_browser', { url: latestVersion.link })}>
{latestVersion?.tag_name}
</a>{' '}
is now available!
</>
),
}) })
}, 6000)
setTimeout(() => {
this.setState({
notification: null,
})
}, 6000)
}
} }
// Period check to only show progress bar when downloading files // Period check to only show progress bar when downloading files