fix theme list and add launching server with game

This commit is contained in:
SpikeHD
2022-06-05 21:40:16 -07:00
parent 8db8dd12e9
commit f5bb2b9bc5
2 changed files with 18 additions and 1 deletions

View File

@@ -104,6 +104,23 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
// Connect to proxy // Connect to proxy
await invoke('connect', { port: 8365, certificatePath: await dataDir() + '\\cultivation\\ca' }) 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 // Launch the program

View File

@@ -39,7 +39,7 @@ const defaultTheme = {
export async function getThemeList() { export async function getThemeList() {
// Do some invoke to backend to get the theme list // Do some invoke to backend to get the theme list
const themes = await invoke('get_theme_list', { const themes = await invoke('get_theme_list', {
data_dir: `${await dataDir()}/cultivation` dataDir: `${await dataDir()}/cultivation`
}) as BackendThemeList[] }) as BackendThemeList[]
const list: ThemeList[] = [ const list: ThemeList[] = [
// ALWAYS include default theme // ALWAYS include default theme