Publish Android 1.3.9 and repair Windows autostart
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
param(
|
||||
[string]$RuntimeRoot = "$env:USERPROFILE\craft\CraftMaster\windows-cl-msvc2022-x86_64",
|
||||
[string]$AppName = "QSfera",
|
||||
[switch]$Launch
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Fail([string]$Message) {
|
||||
Write-Error $Message
|
||||
exit 1
|
||||
}
|
||||
|
||||
$runtimeBin = Join-Path $RuntimeRoot "bin"
|
||||
$runtimeExe = Join-Path $runtimeBin "qsfera.exe"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $runtimeExe)) {
|
||||
Fail "QSfera executable was not found: $runtimeExe"
|
||||
}
|
||||
|
||||
$requiredDlls = @(
|
||||
"Qt6Core.dll",
|
||||
"Qt6Gui.dll",
|
||||
"Qt6Widgets.dll",
|
||||
"Qt6Network.dll",
|
||||
"Qt6Qml.dll",
|
||||
"Qt6Quick.dll",
|
||||
"qt6keychain.dll",
|
||||
"kdsingleapplication-qt6.dll"
|
||||
)
|
||||
|
||||
foreach ($dll in $requiredDlls) {
|
||||
$dllPath = Join-Path $runtimeBin $dll
|
||||
if (-not (Test-Path -LiteralPath $dllPath)) {
|
||||
Fail "Required runtime DLL is missing: $dllPath"
|
||||
}
|
||||
}
|
||||
|
||||
$runKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
|
||||
New-ItemProperty -Path $runKey -Name $AppName -PropertyType String -Value $runtimeExe -Force | Out-Null
|
||||
$actualValue = (Get-ItemProperty -Path $runKey).$AppName
|
||||
|
||||
if ($actualValue -ne $runtimeExe) {
|
||||
Fail "Autostart registry value was not updated. Expected '$runtimeExe', got '$actualValue'."
|
||||
}
|
||||
|
||||
Write-Output "OK: $AppName autostart points to $runtimeExe"
|
||||
Write-Output "OK: required Qt6 runtime DLLs are present in $runtimeBin"
|
||||
|
||||
if ($Launch) {
|
||||
Get-Process -Name "qsfera" -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Path -ne $runtimeExe } |
|
||||
Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
|
||||
if (-not (Get-Process -Name "qsfera" -ErrorAction SilentlyContinue | Where-Object { $_.Path -eq $runtimeExe })) {
|
||||
Start-Process -FilePath $runtimeExe -WorkingDirectory $runtimeBin -WindowStyle Hidden
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
|
||||
$process = Get-Process -Name "qsfera" -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Path -eq $runtimeExe } |
|
||||
Select-Object -First 1
|
||||
|
||||
if (-not $process) {
|
||||
Fail "QSfera did not start from $runtimeExe"
|
||||
}
|
||||
|
||||
Write-Output "OK: QSfera is running from $($process.Path) with PID $($process.Id)"
|
||||
}
|
||||
Reference in New Issue
Block a user