Skip to content

Commit

Permalink
[bugfix-733] point to the correct compat folder
Browse files Browse the repository at this point in the history
  • Loading branch information
silentrald committed Jan 10, 2025
1 parent f2ad6c1 commit fb7f68c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/main/services/linux.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ export class LinuxService {

// === Launching === //

private getCompatDataPath(steamPath: string) {
private async getCompatDataPath() {
// Create the compat data path if it doesn't exist.
// If the user never ran Beat Saber through steam before
// using bsmanager, it won't exist, and proton will fail
// to launch the game.
const compatDataPath = path.join(steamPath, "steamapps", "compatdata", BS_APP_ID);
const commonFolder = await this.steamService.getGameFolder(BS_APP_ID);
const compatDataPath = path.resolve(commonFolder, "..", "compatdata", BS_APP_ID);
if (!fs.existsSync(compatDataPath)) {
log.info(`Proton compat data path not found at '${compatDataPath}', creating directory`);
fs.mkdirSync(compatDataPath);
Expand All @@ -56,7 +57,7 @@ export class LinuxService {
launchOptions.admin = false;
}

const compatDataPath = this.getCompatDataPath(steamPath);
const compatDataPath = this.getCompatDataPath();

if (!this.staticConfig.has("proton-folder")) {
throw CustomError.fromError(
Expand Down Expand Up @@ -129,8 +130,7 @@ export class LinuxService {
}

public async getWinePrefixPath(): Promise<string> {
const compatDataPath = this.getCompatDataPath(await this.steamService.getSteamPath());
return path.join(compatDataPath, "pfx");
return path.join(await this.getCompatDataPath(), "pfx");
}

public getProtonPrefix(): string {
Expand Down
3 changes: 2 additions & 1 deletion src/main/services/steam.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ export class SteamService {
}

if (libraryFolders[libKey].apps[gameId] != null) {
return path.join(libraryFolders[libKey].path, "steamapps", "common", gameFolder);
const commonFolder = path.join(libraryFolders[libKey].path, "steamapps", "common");
return gameFolder ? path.join(commonFolder, gameFolder) : commonFolder;
}
}

Expand Down

0 comments on commit fb7f68c

Please sign in to comment.