From c1973a2d2eac2ae589bb2eee36c25b1f5a31eefc Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Wed, 1 Jun 2022 18:59:33 -0700 Subject: [PATCH] reload launcher on bg set --- src/ui/components/menu/Options.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 76c35cd..5f4a053 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -38,6 +38,7 @@ export default class Options extends React.Component { } this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this) + this.setCustomBackground = this.setCustomBackground.bind(this) } async componentDidMount() { @@ -86,13 +87,15 @@ export default class Options extends React.Component { const filename = value.replace(/\\/g, '/').split('/').pop() const localBgPath = (await dataDir() as string).replace(/\\/g, '/') - setConfigOption('customBackground', `${localBgPath}/cultivation/bg/${filename}`) + await setConfigOption('customBackground', `${localBgPath}/cultivation/bg/${filename}`) // Copy the file over to the local directory - invoke('copy_file', { + await invoke('copy_file', { path: value.replace(/\\/g, '/'), newPath: `${localBgPath}cultivation/bg/` }) + + window.location.reload() } render() {