diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 0d11bd7b..356ab357 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -56,23 +56,23 @@ export class BSInstallerService{ } } - public killDownloadProcess(): Promise{ - return new Promise(resolve => { - if(this.downloadProcess?.killed && !this.downloadProcess?.pid){ return resolve(false); } - - this.downloadProcess?.once('exit', () => resolve(true)); - if (process.platform === 'win32') { - ctrlc(this.downloadProcess.pid); - } else { - this.downloadProcess.kill(); - } - setTimeout(() => resolve(false), 3000); - }); - } + public killDownloadProcess(): Promise{ + return new Promise(resolve => { + if(this.downloadProcess?.killed && !this.downloadProcess?.pid){ return resolve(false); } + + this.downloadProcess?.once('exit', () => resolve(true)); + if (process.platform === 'win32') { + ctrlc(this.downloadProcess.pid); + } else { + this.downloadProcess.kill(); + } + setTimeout(() => resolve(false), 3000); + }); + } public async isDotNet6Installed(): Promise{ try{ - const process = spawnSync(`"${this.getDepotDownloaderExePath()}"`, {shell: true}); + const process = spawnSync(this.getDepotDownloaderExePath()); if(process.stderr.toString()){ log.error("no dotnet", process.stderr.toString()); return false; @@ -103,16 +103,16 @@ export class BSInstallerService{ const downloadVersion: BSVersion = {...downloadInfos.bsVersion, ...(path.basename(dest) !== downloadInfos.bsVersion.BSVersion && {name: path.basename(dest)})} this.downloadProcess = spawn( - `"${this.getDepotDownloaderExePath()}"`, - [ - `-app ${BS_APP_ID}`, - `-depot ${BS_DEPOT}`, - `-manifest ${bsVersion.BSManifest}`, - `-username "${downloadInfos.username}"`, - `-dir "${this.localVersionService.getVersionFolder(downloadVersion)}"` - ], - {shell: true, cwd: this.installLocationService.versionsDirectory} - ); + this.getDepotDownloaderExePath(), + [ + "-app", BS_APP_ID, + "-depot", BS_DEPOT, + "-manifest", bsVersion.BSManifest, + "-username", downloadInfos.username, + "-dir", this.localVersionService.getVersionFolder(downloadVersion) + ], + {cwd: this.installLocationService.versionsDirectory} + ); this.utils.ipcSend("start-download-version", {success: true, data: downloadVersion}); diff --git a/src/main/services/steam.service.ts b/src/main/services/steam.service.ts index f98fbf87..1dacbb53 100644 --- a/src/main/services/steam.service.ts +++ b/src/main/services/steam.service.ts @@ -3,11 +3,10 @@ import regedit from 'regedit' import path from "path"; import { parse } from "@node-steam/vdf"; import { readFile } from "fs/promises"; -import { spawn } from "child_process"; import { pathExist } from "../helpers/fs.helpers"; import log from "electron-log"; import psList from 'ps-list'; -import { app } from "electron"; +import { app, shell } from "electron"; export class SteamService{ @@ -95,9 +94,7 @@ export class SteamService{ } public openSteam(): Promise{ - const process = spawn("start", ["steam://open/games"], {shell: true}); - - process.on("error", log.error); + shell.openPath("steam://open/games").catch(e => log.error(e)); return new Promise(async (resolve, reject) => { // Every 3 seconds check if steam is running