diff --git a/MakeZipWindows.ps1 b/Build-Zip.ps1 old mode 100644 new mode 100755 similarity index 75% rename from MakeZipWindows.ps1 rename to Build-Zip.ps1 index 1373d6882..f4a076fe7 --- a/MakeZipWindows.ps1 +++ b/Build-Zip.ps1 @@ -1,5 +1,7 @@ -#!powershell -# +#!/usr/bin/env pwsh + +Set-StrictMode -Version 5.0 + $include_files = @( 'addon.py', 'addon.xml', 'LICENSE', 'README.md', 'service.py' ) $include_paths = @( 'resources/' ) $exclude_files = @( '*.new', '*.orig', '*.pyc' ) @@ -16,10 +18,14 @@ if (Test-Path -LiteralPath $zip_name) { Remove-Item -LiteralPath $zip_name } +# Ensure .NET's current directory is Powershell's working directory +[System.IO.Directory]::SetCurrentDirectory($PWD) + # Create ZIP file -Add-Type -AssemblyName System.IO.Compression +Add-Type -AssemblyName System.IO.Compression.FileSystem + -Write-Host '= Building new package' +Write-Host -fore blue '= Building new package' $zip_file = [System.IO.Compression.ZipFile]::Open($zip_name, 'Create') ForEach ($relative_file in $include_files) { $archive_file = Join-Path -Path $name -ChildPath $relative_file @@ -33,4 +39,5 @@ ForEach ($path in $include_paths) { } } $zip_file.Dispose() -Write-Host "= Successfully wrote package as: $zip_name" +Write-Host "= Successfully wrote package as: " -ForegroundColor:Blue -NoNewLine +Write-Host "$zip_name" -ForegroundColor:Cyan