Compare commits

...

3 Commits

Author SHA1 Message Date
MathieuG-P 5c70a7d974 bumb version 2023-03-15 16:24:16 +01:00
MathieuG-P da8bae8582 Merge pull request #182 from Zagrios/hotfix/steamvr-restore-conflict-on-fast-bs-reboot
[hotfix] steamvr restoration conflict on fast bs reboot
2023-03-15 16:23:44 +01:00
MathieuG-P 4cce24e275 [hotfix] clear timeout on steamvr restoration 2023-03-15 16:22:02 +01:00
2 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bs-manager",
"version": "1.1.0-alpha.1",
"version": "1.1.0-alpha.2",
"description": "A foundation for scalable desktop apps",
"main": "./dist/main/main.js",
"author": {
+8 -6
View File
@@ -41,14 +41,15 @@ export class BSLauncherService{
private async backupSteamVR(): Promise<void>{
const steamVrFolder = await this.getSteamVRPath();
if(!await pathExist(steamVrFolder)){ return; }
return rename(steamVrFolder, steamVrFolder + ".bak");
return rename(steamVrFolder, steamVrFolder + ".bak").catch(log.error);
}
public async restoreSteamVR(): Promise<void>{
console.log("restoreSteamVR");
const steamVrFolder = await this.getSteamVRPath();
const steamVrBackup = steamVrFolder + ".bak";
if(!await pathExist(steamVrBackup)){ return; }
return rename(steamVrFolder + ".bak", steamVrFolder);
return rename(steamVrFolder + ".bak", steamVrFolder).catch(log.error);
}
public isBsRunning(): boolean{
@@ -75,12 +76,13 @@ export class BSLauncherService{
launchArgs = Array.from(new Set(launchArgs).values());
let restoreTimout: NodeJS.Timeout;
if(launchArgs.includes("fpfc")){
await this.backupSteamVR().catch(e => {
log.error(e);
await this.backupSteamVR().catch(() => {
this.restoreSteamVR();
}).finally(() => {
setTimeout(() => this.restoreSteamVR(), 35_000);
restoreTimout = setTimeout(() => this.restoreSteamVR(), 35_000);
});
await timer(2_000).toPromise();
}
@@ -97,7 +99,7 @@ export class BSLauncherService{
this.bsProcess.on('error', err => log.error(err));
this.bsProcess.on('exit', code => {
this.restoreSteamVR();
this.restoreSteamVR().finally(() => clearTimeout(restoreTimout));
this.utilsService.ipcSend("bs-launch.exit", {data: code, success: code === 0})
});