commit
bba5c8a39a
109 files changed
+14085
No files matched your search
@@ -0,0 +1,87 @@
|
||||
# VoidLibC Windows installer (PowerShell).
|
||||
# Copies voidlink.exe + voidloader.exe to %LOCALAPPDATA%\VoidLibC\bin and
|
||||
# optionally registers .vle files to open with voidloader via the registry.
|
||||
#
|
||||
# Usage from a release package (recommended):
|
||||
# powershell -ExecutionPolicy Bypass -File installer\install.ps1
|
||||
#
|
||||
# Usage from a dev build:
|
||||
# powershell -ExecutionPolicy Bypass -File installer\windows\install.ps1 -BuildDir .\build
|
||||
#
|
||||
# Optional parameters:
|
||||
# -BuildDir path cmake build directory (ignored when running from a release package)
|
||||
# -InstallDir path Install directory (default: %LOCALAPPDATA%\VoidLibC\bin)
|
||||
# -RegisterVle Register .vle file association (default: $true)
|
||||
|
||||
param(
|
||||
[string]$BuildDir = "",
|
||||
[string]$InstallDir = "$env:LOCALAPPDATA\VoidLibC\bin",
|
||||
[bool]$RegisterVle = $true
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Release package layout: binaries live in ..\bin\ relative to installer\.
|
||||
# Development layout: binaries live in BuildDir\voidlink\ etc.
|
||||
$PackageBin = Join-Path $PSScriptRoot ".." "bin"
|
||||
if (Test-Path (Join-Path $PackageBin "voidlink.exe")) {
|
||||
$VoidLink = Join-Path $PackageBin "voidlink.exe"
|
||||
$VoidLoader = Join-Path $PackageBin "voidloader.exe"
|
||||
} else {
|
||||
if (-not $BuildDir) { $BuildDir = Join-Path $PSScriptRoot ".." ".." "build" }
|
||||
$VoidLink = Join-Path $BuildDir "voidlink" "voidlink.exe"
|
||||
$VoidLoader = Join-Path $BuildDir "voidloader" "voidloader.exe"
|
||||
}
|
||||
|
||||
foreach ($f in @($VoidLink, $VoidLoader)) {
|
||||
if (-not (Test-Path $f)) {
|
||||
Write-Error (
|
||||
"Not found: $f`n" +
|
||||
"If running from a release package, ensure you extracted the archive first.`n" +
|
||||
"For dev builds, pass -BuildDir to your cmake build directory."
|
||||
)
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
|
||||
|
||||
Write-Host "Installing voidlink.exe -> $InstallDir"
|
||||
Copy-Item -Force $VoidLink (Join-Path $InstallDir "voidlink.exe")
|
||||
Write-Host "Installing voidloader.exe -> $InstallDir"
|
||||
Copy-Item -Force $VoidLoader (Join-Path $InstallDir "voidloader.exe")
|
||||
|
||||
# Add to user PATH if not already present.
|
||||
$userPath = [Environment]::GetEnvironmentVariable("PATH", "User") ?? ""
|
||||
if ($userPath -notlike "*$InstallDir*") {
|
||||
[Environment]::SetEnvironmentVariable(
|
||||
"PATH", "$InstallDir;$userPath", "User")
|
||||
Write-Host "Added $InstallDir to user PATH."
|
||||
Write-Host "(Restart your terminal or log off/on for PATH to take effect.)"
|
||||
}
|
||||
|
||||
# Register .vle file association in HKCU (no admin required).
|
||||
if ($RegisterVle) {
|
||||
$vloaderPath = Join-Path $InstallDir "voidloader.exe"
|
||||
|
||||
# ProgID
|
||||
$progId = "VoidLibC.VLE.1"
|
||||
New-Item -Force -Path "HKCU:\Software\Classes\$progId" |
|
||||
Set-ItemProperty -Name "(Default)" -Value "VoidLibC Executable"
|
||||
New-Item -Force -Path "HKCU:\Software\Classes\$progId\shell\open\command" |
|
||||
Set-ItemProperty -Name "(Default)" -Value "`"$vloaderPath`" `"%1`" %*"
|
||||
|
||||
# .vle extension
|
||||
New-Item -Force -Path "HKCU:\Software\Classes\.vle" |
|
||||
Set-ItemProperty -Name "(Default)" -Value $progId
|
||||
|
||||
Write-Host "Registered .vle -> voidloader.exe via HKCU\Software\Classes"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "VoidLibC installed successfully."
|
||||
Write-Host " voidlink: $(Join-Path $InstallDir 'voidlink.exe')"
|
||||
Write-Host " voidloader: $(Join-Path $InstallDir 'voidloader.exe')"
|
||||
Write-Host ""
|
||||
Write-Host "Run .vle files: double-click in Explorer, or: voidloader hello.vle"
|
||||
Write-Host "Inspect .vls: voidlink dump hello.vls"
|
||||
Reference in new issue
Block a user