Merge branch 'master' into v1.5.0

This commit is contained in:
MathieuG-P
2024-02-02 20:24:16 +01:00
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -6,6 +6,7 @@ import { from } from "rxjs";
import { SteamLauncherService } from "../services/bs-launcher/steam-launcher.service";
import { OculusLauncherService } from "../services/bs-launcher/oculus-launcher.service";
import { SteamService } from "../services/steam.service";
import log from "electron-log";
import isElevated from "is-elevated";
const ipc = IpcService.getInstance();
@@ -19,9 +20,12 @@ ipc.on<boolean>("bs-launch.need-start-as-admin", (_, reply) => {
const steam = SteamService.getInstance();
reply(from(isElevated().then(elevated => {
if(elevated){ return false; }
return steam.isElevated();
return steam.isElevated().catch(e => {
log.error("Error while checking if Steam is running as admin", e);
return false;
});
})));
})
});
ipc.on<LaunchOption>("create-launch-shortcut", (req, reply) => {
const bsLauncher = BSLauncherService.getInstance();
+5
View File
@@ -46,6 +46,11 @@ export class SteamService {
return getProcessPid(SteamService.PROCESS_NAME);
}
/**
* Check if the Steam process is running as administrator
* @throws Can throw an error if the Steam process is running as admin
* @returns true if the Steam process is running as administrator
*/
public async isElevated(): Promise<boolean>{
if(process.platform === "linux"){ return true; }
const steamPid = await this.getSteamPid();