diff --git a/src/main/services/bs-launcher.service.ts b/src/main/services/bs-launcher.service.ts index ae496b21..d7e18031 100644 --- a/src/main/services/bs-launcher.service.ts +++ b/src/main/services/bs-launcher.service.ts @@ -51,7 +51,7 @@ export class BSLauncherService { this.bsmProtocolService.on("launch", link => { log.info("Launch from bsm protocol", link.toString()); const shortcutParams = objectFromEntries(link.searchParams.entries()) as ShortcutParams; - this.openShortcutLaunchWindow(shortcutParams); + this.openShortcutLaunchWindow(shortcutParams).catch(log.error); }); } @@ -293,12 +293,18 @@ export class BSLauncherService { private async openShortcutLaunchWindow(launchOptions: ShortcutParams): Promise{ const launchOption = this.shortcutParamsToLaunchOption(launchOptions); - const bsPath = await this.localVersionService.getInstalledVersionPath(launchOption.version); + const bsPath: string = await (async () => { + const bsPath = await this.localVersionService.getInstalledVersionPath(launchOption.version); + return bsPath ?? this.localVersionService.getVersionPath(launchOption.version); + })().catch(e => { + log.error(e); + return null; + }); - launchOption.version = await this.localVersionService.getVersionOfBSFolder(bsPath, { + launchOption.version = (await this.localVersionService.getVersionOfBSFolder(bsPath, { steam: launchOption.version.steam, oculus: launchOption.version.oculus, - }); + })) ?? launchOption.version; launchOption.version = {...(await this.remoteVersion.getVersionDetails(launchOption.version.BSVersion)), ...launchOption.version}; diff --git a/src/main/services/bs-local-version.service.ts b/src/main/services/bs-local-version.service.ts index 6d13ab08..57871f5e 100644 --- a/src/main/services/bs-local-version.service.ts +++ b/src/main/services/bs-local-version.service.ts @@ -84,6 +84,9 @@ export class BSLocalVersionService { oculus?: boolean; } ): Promise{ + + if(!bsPath){ return null; } + const versionFilePath = path.join(bsPath, 'Beat Saber_Data', 'globalgamemanagers'); const folderVersion = await this.getVersionFromGlobalGameManagerFile(versionFilePath);