[bugfix-801] fixed issue when downloading oculus version in linux

This commit is contained in:
silentrald
2025-02-16 10:28:13 +08:00
parent 8b9b433f64
commit 60af42fe1d
2 changed files with 17 additions and 4 deletions
+16 -3
View File
@@ -1,3 +1,4 @@
import log from "electron-log";
import fetch from "node-fetch";
import { CustomError } from "../../shared/models/exceptions/custom-error.class";
import { mkdirs, createWriteStream, pathExists, WriteStream } from "fs-extra";
@@ -100,8 +101,13 @@ export class OculusDownloader {
}
private async isFileIntegrityValid(file: OculusFileWithName, folder: string): Promise<boolean> {
const [fileName, fileData] = file;
const destination = path.join(folder, fileName);
const [filename, fileData] = file;
const destination = path.join(
folder,
process.platform === "win32"
? filename
: filename.replaceAll("\\", "/")
);
return pathExists(destination).then(exists => {
if(!exists){ return false; }
@@ -176,7 +182,14 @@ export class OculusDownloader {
return from([res])
}
const target = path.join(options.destination, filename);
const target = path.join(
options.destination,
process.platform === "win32"
? filename
: filename.replaceAll("\\", "/")
);
log.info("Downloaded file", `"${filename}"`, "to", `"${target}"`);
return this.downloadManifestFile(file, target).pipe(
catchError(err => {
this.options.logger?.error(err);
@@ -107,7 +107,7 @@ export class BsOculusDownloaderService {
let downloadVersion: BSVersion
return of(downloadInfo.token).pipe(
switchMap(token => {
switchMap(async token => {
isOculusTokenValid(token, log.info); // Log token validity
if(!downloadInfo.isVerification){
return this.createDownloadVersion(downloadInfo.bsVersion).then(({version, dest}) => ({token, version, dest}))