fix erreur when space in path when download a version

This commit is contained in:
MathieuG-P
2023-02-28 23:37:40 +01:00
parent 5b4b962015
commit 5bb92d804b
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -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<boolean>{
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;
@@ -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 (
<div ref={ref} onClick={handleClick} title={t(title)} className={`${className} overflow-hidden cursor-pointer group ${(!withBar && !disabled && (!!typeColor || !!color)) && "hover:brightness-[1.15]"} ${disabled && "brightness-75 cursor-not-allowed"} ${renderTypeColor}`} style={{...style, backgroundColor: primaryColor || color}}>