-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
24 lines (22 loc) · 799 Bytes
/
Copy pathbuild.ps1
File metadata and controls
24 lines (22 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# build.ps1 — package this add-on into <folder-name>.mcaddon (a .zip with BP/RP at root)
$ErrorActionPreference = "Stop"
$root = $PSScriptRoot
$name = Split-Path -Leaf $root
$out = Join-Path $root "$name.mcaddon"
if (Test-Path $out) { Remove-Item $out -Force }
$tops = @()
foreach ($d in @("BP","RP")) { if (Test-Path (Join-Path $root $d)) { $tops += $d } }
$tar = Join-Path $env:SystemRoot "System32\tar.exe"
Push-Location $root
try {
if (Test-Path $tar) {
$a = @("-c","--format","zip","-f",$out) + $tops
& $tar @a
} else {
$zip = Join-Path $root "$name.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path $tops -DestinationPath $zip
Rename-Item $zip $out
}
} finally { Pop-Location }
Write-Host "built $out"