diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/win/zip.ps1	Mon Jun 08 14:46:32 2020 +0100
@@ -0,0 +1,24 @@
+
+Set-StrictMode -Version 2.0
+$ErrorActionPreference = "Stop"
+
+if ($args.length -ne 2) {
+    echo "Usage: zip target.zip sourcedir"
+    exit 2
+}
+
+$sourcename = $args[1]
+$targetname = $args[0]
+
+$source = (Resolve-Path $sourcename)
+
+if ([System.IO.Path]::IsPathRooted($targetname)) {
+   $target = $targetname
+} else {
+   $target = "$pwd\$targetname"
+}
+
+echo "Compressing from $source to $target..." | Out-Host
+
+[io.compression.zipfile]::CreateFromDirectory($source, $target)
+