Skip to content

Commit 64a50f9

Browse files
committed
MSIX build: remove $-prefixed installer leftovers, report unusual file names
1 parent b3dbd1f commit 64a50f9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎packaging/windows/build_msix.ps1‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Run "PyInstaller build" { python -m PyInstaller --noconfirm --distpath dist pack
3131
Run "MEDHA.exe --selftest" { & dist\MEDHA\MEDHA.exe --selftest }
3232
Copy-Item -Recurse dist\MEDHA "$layout\MEDHA"
3333
(Get-Content packaging\windows\AppxManifest.xml -Raw).Replace("__VERSION__", $msixVer) | Set-Content "$layout\AppxManifest.xml" -Encoding utf8
34+
# MSIX rejects some file names (makeappx error 0x8007007b). Drop NSIS/7z leftovers
35+
# whose names start with '$', then report any remaining name outside the safe set.
36+
Get-ChildItem $layout -Recurse -Force | Where-Object { $_.Name -like '$*' } | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
37+
$bad = Get-ChildItem $layout -Recurse -Force | Where-Object { $_.Name -notmatch '^[A-Za-z0-9_.\- ()+~@,=\[\]]+$' -or $_.Name -match '[. ]$' -or $_.Name -match '^(CON|PRN|AUX|NUL|COM\d|LPT\d)(\..*)?$' }
38+
if ($bad) { Write-Host ("::warning title=Unusual file names in package::" + (($bad | ForEach-Object { $_.FullName.Substring($layout.Length) }) -join "%0A")) }
3439
$makeappx = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\makeappx.exe" | Sort-Object FullName -Descending | Select-Object -First 1
3540
Run "makeappx pack" { & $makeappx.FullName pack /v /d $layout /p "dist\MEDHA-$ver.msix" /o }
3641
Compress-Archive -Path dist\MEDHA -DestinationPath "dist\MEDHA-$ver-portable.zip" -Force

0 commit comments

Comments
 (0)