mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[bugfix-627] reverted #577 PR
This commit is contained in:
@@ -5,7 +5,6 @@ import { BSVersion } from "shared/bs-version.interface";
|
||||
import { RequestService } from "./request.service";
|
||||
import { readJSON } from "fs-extra";
|
||||
import { allSettled } from "../../shared/helpers/promise.helpers";
|
||||
import { StaticConfigurationService } from "./static-configuration.service";
|
||||
|
||||
export class BSVersionLibService {
|
||||
private readonly REMOTE_BS_VERSIONS_URL: string = "https://raw.githubusercontent.com/Zagrios/bs-manager/master/assets/jsons/bs-versions.json";
|
||||
@@ -15,14 +14,12 @@ export class BSVersionLibService {
|
||||
|
||||
private utilsService: UtilsService;
|
||||
private requestService: RequestService;
|
||||
private staticConfigurationService: StaticConfigurationService;
|
||||
|
||||
private bsVersions: BSVersion[];
|
||||
|
||||
private constructor() {
|
||||
this.utilsService = UtilsService.getInstance();
|
||||
this.requestService = RequestService.getInstance();
|
||||
this.staticConfigurationService = StaticConfigurationService.getInstance();
|
||||
}
|
||||
|
||||
public static getInstance(): BSVersionLibService {
|
||||
@@ -38,28 +35,12 @@ export class BSVersionLibService {
|
||||
|
||||
private async getLocalVersions(): Promise<BSVersion[]> {
|
||||
const localVersionsPath = path.join(this.utilsService.getAssestsJsonsPath(), this.VERSIONS_FILE);
|
||||
|
||||
if (process.platform === "linux") {
|
||||
let versions = this.staticConfigurationService.get("versions");
|
||||
if (!versions) {
|
||||
versions = (await readJSON(localVersionsPath)) as BSVersion[];
|
||||
this.staticConfigurationService.set("versions", versions);
|
||||
}
|
||||
return versions;
|
||||
}
|
||||
|
||||
return readJSON(localVersionsPath);
|
||||
}
|
||||
|
||||
private async updateLocalVersions(versions: BSVersion[]): Promise<void> {
|
||||
const localVersionsPath = path.join(this.utilsService.getAssestsJsonsPath(), this.VERSIONS_FILE);
|
||||
|
||||
// Do not write on readonly memory in linux when running on AppImage
|
||||
if (process.platform === "linux") {
|
||||
this.staticConfigurationService.set("versions", versions);
|
||||
} else {
|
||||
writeFileSync(localVersionsPath, JSON.stringify(versions, null, "\t"), { encoding: "utf-8", flag: "w" });
|
||||
}
|
||||
writeFileSync(localVersionsPath, JSON.stringify(versions, null, "\t"), { encoding: "utf-8", flag: "w" });
|
||||
}
|
||||
|
||||
private async loadBsVersions(): Promise<BSVersion[]> {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { pathExistsSync } from "fs-extra";
|
||||
import path from "path";
|
||||
import { PROTON_BINARY_PREFIX, WINE_BINARY_PREFIX } from "main/constants";
|
||||
import { Observable, Subject } from "rxjs";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
|
||||
export class StaticConfigurationService {
|
||||
@@ -90,7 +89,6 @@ export interface StaticConfigKeyValues {
|
||||
"use-symlinks": boolean;
|
||||
|
||||
// Linux Specific static configs
|
||||
"versions": BSVersion[];
|
||||
"proton-folder": string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user