diff options
| author | ruki <[email protected]> | 2024-09-14 00:59:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-09-14 00:59:59 +0800 |
| commit | 86f30703b9d2ea74710aa4cd2a99b03568331724 (patch) | |
| tree | c1b81eb2aab7cf7fbd2a2549a62ce07e91f5af10 /xmake/scripts | |
| parent | 1be14dcae978f2969e708bb9224e36a8a7b6f77f (diff) | |
unzip file using powershell
Diffstat (limited to 'xmake/scripts')
| -rwxr-xr-x | xmake/scripts/unzip.ps1 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xmake/scripts/unzip.ps1 b/xmake/scripts/unzip.ps1 new file mode 100755 index 000000000..46947bfd3 --- /dev/null +++ b/xmake/scripts/unzip.ps1 @@ -0,0 +1,24 @@ +#!/usr/bin/env pwsh +#Requires -version 5 + +param ( + [string]$archivefile, + [string]$outputdir +) + +& { + function writeErrorTip($msg) { + Write-Host $msg -BackgroundColor Red -ForegroundColor White + } + + function unzip { + try { + Expand-Archive -Path $archivefile -DestinationPath $outputdir + } catch { + writeErrorTip 'Unzip failed!' + throw + } + } + + unzip +} |
