Merge branch 'ThioJoe:main' into patch-1

pull/13/head
Nanashi 2025-12-19 00:16:58 -06:00 committed by GitHub
commit 99f2e27bf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View File

@ -22,7 +22,7 @@ function Get-LatestRelease {
return $null
}
if (-not $releases) { Write-Error "No releases found for $repoOwner/$repoName."; return $null; }
if (-not $releases) { Write-Error "No releases found for $repoOwner/$repoName."; return $null; }
# Pick the top entry once sorted by published_at descending
$latestRelease = $releases | Sort-Object -Property published_at -Descending | Select-Object -First 1
@ -125,8 +125,17 @@ if ($depsZipUrl) {
# Remove existing Dependencies folder and expand the zip
if (Test-Path $topDepsFolder) { Remove-Item -Path $topDepsFolder -Recurse -Force }
Expand-Archive -LiteralPath $depsZipPath -DestinationPath $topDepsFolder -Force
# Use Expand-Archive cmdlet by default because it's safe for constrained language mode. Fall back to .NET assembly if it fails.
try {
Expand-Archive -LiteralPath $depsZipPath -DestinationPath $topDepsFolder -Force -ErrorAction Stop
}
catch {
Write-Warning "Standard extraction failed, attempting .NET fallback. The error was: $($_.Exception.Message)"
# Fallback using .NET System.IO.Compression (Fixes issues in non-EN Windows Sandbox)
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($depsZipPath, $topDepsFolder)
}
}
else { Write-Warning "No $depsZipName found in $latestTag, skipping dependency download."; }
@ -156,4 +165,3 @@ if ($removeMsStoreAsSource.IsPresent) {
# Automatically accept source agreements to avoid prompts. Mostly applies to msstore.
winget list --accept-source-agreements | Out-Null
}

View File

@ -32,6 +32,9 @@ CiTool.exe --refresh --json | Out-Null # Refreshes policy. Use json output param
# Change execution policy for powershell to allow running scripts. Normally it shows an error about a more specific policy (Process level Bypass policy), but it doesn't matter so we hide it via try/catch
try { Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine -ErrorAction Stop | Out-Null } catch {}
# Enable Clipboard History
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Clipboard" -Name "EnableClipboardHistory" -Value 1 -Type DWord -Force
# -----------------------------------------------------------------------------------------
# ---- Add 'Open PowerShell Here' and 'Open CMD Here' to context menu -------