fix path.join failing due to undefined process.env.DOTNET_ROOT (#1306)

This commit is contained in:
osiris-plus
2025-07-22 07:59:52 +03:00
committed by GitHub
parent b25e264171
commit b9db3d92af

View File

@@ -748,11 +748,19 @@ function getVersion() {
}
function isDotNetInstalled() {
let dotnetPath = path.join(process.env.DOTNET_ROOT, 'dotnet');
if (!process.env.DOTNET_ROOT || !fs.existsSync(dotnetPath)) {
let dotnetPath;
if (process.env.DOTNET_ROOT) {
dotnetPath = path.join(process.env.DOTNET_ROOT, 'dotnet');
if (!fs.existsSync(dotnetPath)) {
// fallback to command
dotnetPath = 'dotnet';
}
} else {
// fallback to command
dotnetPath = 'dotnet';
}
console.log('Checking for .NET installation at:', dotnetPath);
// Fallback to system .NET runtime