summaryrefslogtreecommitdiff
path: root/xmake/scripts/unzip.ps1
blob: 46947bfd3133aad8c69991a4d0600ee18be2eb45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}