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