From 7a4175327521725153d0cb6b45f349d4ffeb068b Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:09:49 -0600 Subject: [PATCH] Add webcache clearing --- src-tauri/lang/en.json | 3 ++- src/ui/components/menu/Options.tsx | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src-tauri/lang/en.json b/src-tauri/lang/en.json index 872eb681..c66a8df6 100644 --- a/src-tauri/lang/en.json +++ b/src-tauri/lang/en.json @@ -35,7 +35,8 @@ "un_elevated": "Run the game non-elevated (no admin)", "redirect_more": "Also redirect other MHY games", "check_aagl": "For more options, check the other launcher", - "grasscutter_elevation": "Method of running GC on restricted ports" + "grasscutter_elevation": "Method of running GC on restricted ports", + "web_cache": "Delete webCaches folder" }, "downloads": { "grasscutter_fullbuild": "Download Grasscutter All-in-One", diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index d89bfa73..1cc54dba 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -103,6 +103,7 @@ export default class Options extends React.Component { this.setCustomBackground = this.setCustomBackground.bind(this) this.toggleEncryption = this.toggleEncryption.bind(this) this.removeRSA = this.removeRSA.bind(this) + this.deleteWebCache = this.deleteWebCache.bind(this) this.addMigotoDelay = this.addMigotoDelay.bind(this) this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this) } @@ -333,6 +334,18 @@ export default class Options extends React.Component { }) } + async deleteWebCache() { + alert('Cultivation may freeze for a moment while this occurs!') + + // Get webCaches folder path + const pathArr = this.state.game_install_path.replace(/\\/g, '/').split('/') + pathArr.pop() + const path = pathArr.join('/') + '/GenshinImpact_Data/webCaches' + + // Delete the folder + await invoke('dir_delete', { path: path }) + } + async toggleOption(opt: keyof Configuration) { const changedVal = !(await getConfigOption(opt)) @@ -643,6 +656,19 @@ export default class Options extends React.Component { + + + + ) }