Mercurial > hg > sonic-annotator
annotate deploy/win/zip.ps1 @ 399:a3912193ce69 tip
Default branch is now named default on git as well as hg, in case we ever want to switch to mirroring in the other direction
author | Chris Cannam |
---|---|
date | Thu, 27 Aug 2020 15:57:37 +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 |