EZPPLauncher/electron/netUtils.js

26 lines
728 B
JavaScript
Raw Normal View History

2024-04-14 15:16:46 +00:00
const { exec } = require("child_process");
async function isNet8Installed() {
2024-04-14 15:55:09 +00:00
return new Promise((resolve) => {
exec("dotnet --list-runtimes", (error, stdout, stderr) => {
2024-04-14 15:16:46 +00:00
if (error) {
resolve(false);
return;
}
if (stderr) {
resolve(false);
return;
}
const version = stdout.trim();
2024-04-14 15:55:09 +00:00
for (const line of version.split('\n')) {
if (line.startsWith("Microsoft.WindowsDesktop.App 8.")) {
resolve(true);
break;
}
}
resolve(false);
2024-04-14 15:16:46 +00:00
})
});
}
module.exports = { isNet8Installed };