Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions crates/vfox/embedded-plugins/vfox-dotnet/hooks/post_install.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
--- Installs .NET SDK using Microsoft's official installer script
--- @param ctx table Context provided by vfox
function PLUGIN:PostInstall(ctx)
local cmd = require("cmd")

local sdkInfo = ctx.sdkInfo["dotnet"]
local path = sdkInfo.path
local version = sdkInfo.version
Expand All @@ -11,18 +9,26 @@ function PLUGIN:PostInstall(ctx)
local sep = RUNTIME.osType == "windows" and "\\" or "/"

if RUNTIME.osType == "windows" then
-- Windows: Use PowerShell script
-- Windows: Use PowerShell script with -Command to avoid cmd.exe quote parsing issues
-- Same pattern as vfox-aapt2: outer double quotes, inner single quotes
local scriptPath = path .. sep .. "dotnet-install.ps1"
cmd.exec("powershell -ExecutionPolicy Bypass -File '" .. scriptPath .. "' -InstallDir '" .. path .. "' -Version '" .. version .. "' -NoPath")
local ps_cmd = string.format('powershell -ExecutionPolicy Bypass -Command "& \'%s\' -InstallDir \'%s\' -Version \'%s\' -NoPath"', scriptPath, path, version)
local result = os.execute(ps_cmd)
if not result then
error("Failed to run dotnet-install.ps1")
end
-- Clean up installer script
os.remove(scriptPath)
else
-- Linux/macOS: Use bash script
local scriptPath = path .. sep .. "dotnet-install.sh"
-- Make script executable
cmd.exec("chmod +x '" .. scriptPath .. "'")
os.execute("chmod +x '" .. scriptPath .. "'")
-- Run the installer
cmd.exec("'" .. scriptPath .. "' --install-dir '" .. path .. "' --version '" .. version .. "' --no-path")
local result = os.execute("'" .. scriptPath .. "' --install-dir '" .. path .. "' --version '" .. version .. "' --no-path")
if not result then
error("Failed to run dotnet-install.sh")
end
-- Clean up installer script
os.remove(scriptPath)
end
Expand Down
Loading