mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[chore] no need for shell + use native openPath
This commit is contained in:
@@ -56,23 +56,23 @@ export class BSInstallerService{
|
||||
}
|
||||
}
|
||||
|
||||
public killDownloadProcess(): Promise<boolean>{
|
||||
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<boolean>{
|
||||
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<boolean>{
|
||||
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});
|
||||
|
||||
|
||||
@@ -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<void>{
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user