Mercurial > hg > sonic-annotator
annotate deploy/win/zip.ps1 @ 385:96e5adab61c2
Toward making Windows zip
author | Chris Cannam |
---|---|
date | Mon, 08 Jun 2020 14:46:32 +0100 |
parents | |
children | 0a45b9debc30 |
rev | line source |
---|---|
Chris@385 | 1 |
Chris@385 | 2 Set-StrictMode -Version 2.0 |
Chris@385 | 3 $ErrorActionPreference = "Stop" |
Chris@385 | 4 |
Chris@385 | 5 if ($args.length -ne 2) { |
Chris@385 | 6 echo "Usage: zip target.zip sourcedir" |
Chris@385 | 7 exit 2 |
Chris@385 | 8 } |
Chris@385 | 9 |
Chris@385 | 10 $sourcename = $args[1] |
Chris@385 | 11 $targetname = $args[0] |
Chris@385 | 12 |
Chris@385 | 13 $source = (Resolve-Path $sourcename) |
Chris@385 | 14 |
Chris@385 | 15 if ([System.IO.Path]::IsPathRooted($targetname)) { |
Chris@385 | 16 $target = $targetname |
Chris@385 | 17 } else { |
Chris@385 | 18 $target = "$pwd\$targetname" |
Chris@385 | 19 } |
Chris@385 | 20 |
Chris@385 | 21 echo "Compressing from $source to $target..." | Out-Host |
Chris@385 | 22 |
Chris@385 | 23 [io.compression.zipfile]::CreateFromDirectory($source, $target) |
Chris@385 | 24 |