From 05caa7c7a36d617603610001a6078fa165981d73 Mon Sep 17 00:00:00 2001 From: Erik <74606950+wehigami@users.noreply.github.com> Date: Sat, 27 May 2023 14:21:18 +0000 Subject: [PATCH] Update src/ui/Main.tsx Co-authored-by: Thoronium <107363768+NotThorny@users.noreply.github.com> --- src/ui/Main.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 757aae9..96fee11 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -198,6 +198,16 @@ export class Main extends React.Component { async componentDidUpdate(prevProps: Readonly, prevState: Readonly) { 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({