From 8b30b7c1fafdde17e7616409188fc55135ddf241 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Sun, 14 Apr 2024 17:55:09 +0200 Subject: [PATCH] fix .net8 detection --- electron/netUtils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/electron/netUtils.js b/electron/netUtils.js index a1a14df..9aee28b 100644 --- a/electron/netUtils.js +++ b/electron/netUtils.js @@ -1,8 +1,8 @@ const { exec } = require("child_process"); async function isNet8Installed() { - return new Promise((resolve, reject) => { - exec("dotnet --version", (error, stdout, stderr) => { + return new Promise((resolve) => { + exec("dotnet --list-runtimes", (error, stdout, stderr) => { if (error) { resolve(false); return; @@ -12,7 +12,13 @@ async function isNet8Installed() { return; } const version = stdout.trim(); - resolve(version.startsWith("8.")); + for (const line of version.split('\n')) { + if (line.startsWith("Microsoft.WindowsDesktop.App 8.")) { + resolve(true); + break; + } + } + resolve(false); }) }); }