fix vbs regidit not find script

This commit is contained in:
MathieuG-P
2023-03-14 00:26:53 +01:00
parent 9862dfa78d
commit ec3c6ce26e
4 changed files with 19 additions and 15 deletions
-3
View File
@@ -32,9 +32,6 @@ log.transports.file.resolvePath = (() => {
log.catchErrors();
const utilsService = UtilsService.getInstance();
utilsService.setAssetsPath(app.isPackaged ? path.join(process.resourcesPath, 'assets') : path.join(__dirname, '../../assets'));
if (process.env.NODE_ENV === 'production') {
const sourceMapSupport = require('source-map-support');
sourceMapSupport.install();
+1 -1
View File
@@ -80,7 +80,7 @@ export class BSLauncherService{
log.error(e);
this.restoreSteamVR();
}).finally(() => {
setTimeout(() => this.restoreSteamVR(), 20_000);
setTimeout(() => this.restoreSteamVR(), 35_000);
});
await timer(2_000).toPromise();
}
+17 -10
View File
@@ -5,6 +5,7 @@ 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";
export class SteamService{
@@ -47,21 +48,27 @@ export class SteamService{
}
public async getGameFolder(gameId: string, gameFolder?: string): Promise<string>{
const steamPath = await this.getSteamPath();
try{
const steamPath = await this.getSteamPath();
let libraryFolders: any = path.join(steamPath, 'steamapps', 'libraryfolders.vdf');
let libraryFolders: any = path.join(steamPath, 'steamapps', 'libraryfolders.vdf');
if(!(await pathExist(libraryFolders))){ return null; }
libraryFolders = parse(await readFile(libraryFolders, {encoding: 'utf-8'}));
if(!(await pathExist(libraryFolders))){ return null; }
libraryFolders = parse(await readFile(libraryFolders, {encoding: 'utf-8'}));
if(!libraryFolders.libraryfolders){ return null; }
libraryFolders = libraryFolders.libraryfolders
if(!libraryFolders.libraryfolders){ return null; }
libraryFolders = libraryFolders.libraryfolders
for(const libKey in Object.keys(libraryFolders)){
if(!libraryFolders[libKey] || !libraryFolders[libKey]["apps"]){ continue; }
if(libraryFolders[libKey]["apps"][gameId] != null){ return path.join(libraryFolders[libKey]["path"], "steamapps", "common", gameFolder); };
for(const libKey in Object.keys(libraryFolders)){
if(!libraryFolders[libKey] || !libraryFolders[libKey]["apps"]){ continue; }
if(libraryFolders[libKey]["apps"][gameId] != null){ return path.join(libraryFolders[libKey]["path"], "steamapps", "common", gameFolder); };
}
return null;
}
catch(e){
log.error(e);
return null;
}
return null;
}
public openSteam(): Promise<boolean>{
+1 -1
View File
@@ -12,7 +12,7 @@ export class UtilsService{
private static instance: UtilsService;
private assetsPath: string = '';
private assetsPath: string = app.isPackaged ? path.join(process.resourcesPath, 'assets') : path.join(__dirname, '../../../assets');
private windows: Map<AppWindow, BrowserWindow> = new Map<AppWindow, BrowserWindow>();