mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
Update src/ui/Main.tsx
Co-authored-by: Thoronium <107363768+NotThorny@users.noreply.github.com>
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user