From 60af42fe1d9e57f24440819b31306e910a3ac603 Mon Sep 17 00:00:00 2001 From: silentrald Date: Sun, 16 Feb 2025 10:28:13 +0800 Subject: [PATCH] [bugfix-801] fixed issue when downloading oculus version in linux --- src/main/models/oculus-downloader.class.ts | 19 ++++++++++++++++--- .../bs-oculus-downloader.service.ts | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/models/oculus-downloader.class.ts b/src/main/models/oculus-downloader.class.ts index 47587e73..b9592ea3 100644 --- a/src/main/models/oculus-downloader.class.ts +++ b/src/main/models/oculus-downloader.class.ts @@ -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 { - 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); diff --git a/src/main/services/bs-version-download/bs-oculus-downloader.service.ts b/src/main/services/bs-version-download/bs-oculus-downloader.service.ts index 3743188f..11c2cc7e 100644 --- a/src/main/services/bs-version-download/bs-oculus-downloader.service.ts +++ b/src/main/services/bs-version-download/bs-oculus-downloader.service.ts @@ -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}))