feat: download and include dotnet runtime in the appimage on linux (#1289)

This commit is contained in:
rs189
2025-07-14 12:42:36 +09:00
committed by GitHub
parent f4f78bb5ec
commit 40861ef120
3 changed files with 145 additions and 4 deletions

View File

@@ -13,6 +13,15 @@ const { spawn, spawnSync } = require('child_process');
const fs = require('fs');
const https = require('https');
// Include bundled .NET runtime
const bundledDotNetPath = path.join(process.resourcesPath, 'dotnet-runtime');
const bundledDotnet = path.join(bundledDotNetPath, 'bin', 'dotnet');
if (fs.existsSync(bundledDotnet)) {
process.env.DOTNET_ROOT = bundledDotNetPath;
process.env.PATH = `${path.dirname(bundledDotnet)}:${process.env.PATH}`;
}
if (!isDotNetInstalled()) {
app.whenReady().then(() => {
dialog.showErrorBox(
@@ -24,7 +33,7 @@ if (!isDotNetInstalled()) {
return;
}
// get launch arguments
// Get launch arguments
let appImagePath = process.env.APPIMAGE;
const args = process.argv.slice(1);
const noInstall = args.includes('--no-install');
@@ -527,6 +536,14 @@ function isDotNetInstalled() {
// Assume .NET is already installed on macOS
return true;
}
// Check for bundled .NET runtime
if (fs.existsSync(bundledDotnet)) {
console.log('Using bundled .NET runtime at:', bundledDotNetPath);
return true;
}
// Fallback to system .NET runtime
const result = spawnSync('dotnet', ['--list-runtimes'], {
encoding: 'utf-8'
});