From d9b820c842bb3c6786fc52a5e89f3984af2310e9 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Thu, 27 Nov 2025 00:31:12 -0700 Subject: [PATCH] Return proper value from getGameExecutable getGameExecutable returns the executable name only. basename can remove filetype instead of splitting. --- src/utils/game.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/utils/game.ts b/src/utils/game.ts index a8fabf0..d42dedb 100644 --- a/src/utils/game.ts +++ b/src/utils/game.ts @@ -2,18 +2,17 @@ import { invoke } from '@tauri-apps/api' import { basename, dirname, join } from '@tauri-apps/api/path' import { getConfigOption } from './configuration' -// For god's sake i don't know why the game's EXECUTABLE is called game install PATH. -// either game_install_dir or game_exectuable_path. not a mix of them :sob: - -// The following method is just an adapter to limit the scope of changes in this commit. -// Ideally, all instances of these single, autonomous, disjointed methods should be replaced with methods in configuration.ts which are much nicer. (if named correctly) -export const getGameExecutable = () => getConfigOption('game_install_path') export const getGrasscutterJar = () => getConfigOption('grasscutter_path') +export async function getGameExecutable() { + const exe_path = await getConfigOption('game_install_path') + return await basename(exe_path) +} + export async function getGameVersion() { const execPath = await getConfigOption('game_install_path') const rootPath = await dirname(execPath) - const baseName = (await basename(execPath)).split('.exe')[0] + const baseName = (await basename(execPath, ".exe")) const datapath = await join(rootPath, `${baseName}_Data`) const asbPath = await join(datapath, 'StreamingAssets', 'asb_settings.json') const hasAsb = await invoke('dir_exists', { path: asbPath })