Update src/ui/Main.tsx

Co-authored-by: Thoronium <107363768+NotThorny@users.noreply.github.com>
This commit is contained in:
Erik
2023-05-27 14:21:18 +00:00
committed by GitHub
parent 681c1fce3e
commit 05caa7c7a3

View File

@@ -198,6 +198,16 @@ export class Main extends React.Component<IProps, IState> {
async componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>) {
const game_path = await getConfigOption('game_install_path')
// Check if game exists at set location
const game_exists: boolean = ((await invoke('dir_exists', {
path: game_path,
})) as boolean)
// Set no game path so the user understands it doesn't exist there
if (!game_exists) {
setConfigOption('game_install_path', '')
}
//if previous state is not equal the current one - update the game_install_path to be the current game path
if (prevState.game_install_path != game_path) {
this.setState({