From 5bb92d804bd44f9228dd3ce09faecf24d47327c5 Mon Sep 17 00:00:00 2001 From: MathieuG-P <40181755+Zagrios@users.noreply.github.com> Date: Tue, 28 Feb 2023 23:37:40 +0100 Subject: [PATCH] fix erreur when space in path when download a version --- src/main/services/bs-installer.service.ts | 8 ++++++-- src/renderer/components/shared/bsm-button.component.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 9f5f1452..26a25aa3 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -38,8 +38,12 @@ export class BSInstallerService{ return BSInstallerService.instance; } + private escapeSpaces(path: string): string{ + return `\"${path}\"` + } + private getDepotDownloaderExePath(): string{ - return path.join(this.utils.getAssetsScriptsPath(), 'depot-downloader', 'DepotDownloader.exe'); + return this.escapeSpaces(path.join(this.utils.getAssetsScriptsPath(), 'depot-downloader', 'DepotDownloader.exe')); } private removeSpecialSchar(txt: string): string{ return txt.replaceAll(/\[|\]/g, ""); } @@ -68,7 +72,7 @@ export class BSInstallerService{ public async isDotNet6Installed(): Promise{ try{ - const process = spawnSync(this.getDepotDownloaderExePath()); + const process = spawnSync(this.getDepotDownloaderExePath(), {shell: true}); const out = process.output.toString(); if(out.includes(".NET runtime can be found at")){ return false; } return true; diff --git a/src/renderer/components/shared/bsm-button.component.tsx b/src/renderer/components/shared/bsm-button.component.tsx index fb95f172..957aee10 100644 --- a/src/renderer/components/shared/bsm-button.component.tsx +++ b/src/renderer/components/shared/bsm-button.component.tsx @@ -52,7 +52,7 @@ export function BsmButton({className, style, imgClassName, iconClassName, icon, return ""; })(); - const handleClick = (e: MouseEvent) => !disabled && onClick(e); + const handleClick = (e: MouseEvent) => !disabled && onClick?.(e); return (