From 9638c65407d94f4e258f9c8a530525d0f9f7f9e3 Mon Sep 17 00:00:00 2001 From: Pierce Thompson Date: Tue, 8 Aug 2023 23:21:48 -0400 Subject: [PATCH 1/2] Fix Depot Downloader not working on Linux --- src/main/services/bs-installer.service.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 4cf477d6..528ae649 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -42,14 +42,14 @@ export class BSInstallerService { } private getDepotDownloaderExePath(): string { - return path.join(this.utils.getAssetsScriptsPath(), "depot-downloader", "DepotDownloader.exe"); + return path.join(this.utils.getAssetsScriptsPath(), "depot-downloader", `DepotDownloader.${process.platform === 'linux' ? 'dll' : 'exe'}`); } public async isDotNet6Installed(): Promise { try { - const process = spawnSync(this.getDepotDownloaderExePath()); - if (process.stderr.toString()) { - log.error("no dotnet", process.stderr.toString()); + const proc = spawnSync(`${process.platform === 'linux' ? 'dotnet ' : ''}${this.getDepotDownloaderExePath()}`); + if (proc.stderr?.toString()) { + log.error("no dotnet", proc.stderr.toString()); return false; } return true; @@ -79,9 +79,13 @@ export class BSInstallerService { await ensureDir(this.installLocationService.versionsDirectory); + const isLinux = process.platform === 'linux'; + const exePath = this.getDepotDownloaderExePath(); + const args = DepotDownloader.buildArgs(depotDownloaderOptions); + return new DepotDownloader({ - command: this.getDepotDownloaderExePath(), - args: DepotDownloader.buildArgs(depotDownloaderOptions), + command: isLinux ? 'dotnet' : this.getDepotDownloaderExePath(), + args: isLinux ? [exePath, ...args] : [exePath], options: { cwd: this.installLocationService.versionsDirectory }, echoStartData: downloadVersion }, log); From 31db079b086ccc32595b1c2327d6c6906402befc Mon Sep 17 00:00:00 2001 From: Pierce Thompson Date: Wed, 9 Aug 2023 17:16:15 -0400 Subject: [PATCH 2/2] Fix process command/args --- src/main/services/bs-installer.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 528ae649..162497d4 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -47,7 +47,9 @@ export class BSInstallerService { public async isDotNet6Installed(): Promise { try { - const proc = spawnSync(`${process.platform === 'linux' ? 'dotnet ' : ''}${this.getDepotDownloaderExePath()}`); + const proc = process.platform === 'linux' + ? spawnSync('dotnet', [this.getDepotDownloaderExePath()]) + : spawnSync(this.getDepotDownloaderExePath()); if (proc.stderr?.toString()) { log.error("no dotnet", proc.stderr.toString()); return false; @@ -84,8 +86,8 @@ export class BSInstallerService { const args = DepotDownloader.buildArgs(depotDownloaderOptions); return new DepotDownloader({ - command: isLinux ? 'dotnet' : this.getDepotDownloaderExePath(), - args: isLinux ? [exePath, ...args] : [exePath], + command: isLinux ? 'dotnet' : exePath, + args: isLinux ? [exePath, ...args] : args, options: { cwd: this.installLocationService.versionsDirectory }, echoStartData: downloadVersion }, log); @@ -110,7 +112,7 @@ export class BSInstallerService { } return event; })).subscribe(sub); - + }).catch(err => sub.error({ type: DepotDownloaderEventType.Error, subType: DepotDownloaderErrorEvent.Unknown,