From f5bb2b9bc5e16270e75a41745c8534bb7c90ac90 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 5 Jun 2022 21:40:16 -0700 Subject: [PATCH] fix theme list and add launching server with game --- src/ui/components/ServerLaunchSection.tsx | 17 +++++++++++++++++ src/utils/themes.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index cf30e19..13d3621 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -104,6 +104,23 @@ export default class ServerLaunchSection extends React.Component // Connect to proxy await invoke('connect', { port: 8365, certificatePath: await dataDir() + '\\cultivation\\ca' }) + + // Open server as well if the options are set + if (config.grasscutter_with_game) { + let jarFolder = config.grasscutter_path + + if (jarFolder.includes('/')) { + jarFolder = jarFolder.substring(0, config.grasscutter_path.lastIndexOf('/')) + } else { + jarFolder = jarFolder.substring(0, config.grasscutter_path.lastIndexOf('\\')) + } + + await invoke('run_jar', { + path: config.grasscutter_path, + executeIn: jarFolder, + javaPath: config.java_path || '' + }) + } } // Launch the program diff --git a/src/utils/themes.ts b/src/utils/themes.ts index 24f9d44..e0c3309 100644 --- a/src/utils/themes.ts +++ b/src/utils/themes.ts @@ -39,7 +39,7 @@ const defaultTheme = { export async function getThemeList() { // Do some invoke to backend to get the theme list const themes = await invoke('get_theme_list', { - data_dir: `${await dataDir()}/cultivation` + dataDir: `${await dataDir()}/cultivation` }) as BackendThemeList[] const list: ThemeList[] = [ // ALWAYS include default theme