From 5e951ab46aba35a4fdf77fe921234777b95361e0 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Thu, 9 Dec 2021 12:03:11 -0600 Subject: [PATCH] move temp file into place (broken) this doens't work if os.TempDir and the current directory are in different filesystems because it's a cross-filesystem move. Annoying af honestly. I think I have to use zip.Create instead of zip.CreateFromDir and handle the file exclusion myself. I could in theory create the zip into memory and then write it to avoid CreateFromDir trying to circularly zip up its own output but I don't like that. --- zip.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zip.go b/zip.go index cc784fa..16da6d6 100644 --- a/zip.go +++ b/zip.go @@ -96,5 +96,10 @@ func zipcmd(args []string) { bail(1, "zip not created: %v", err) } + // filepath.IsAbs log_info.Printf("created zip archive at %v", abspath) + if err := os.Rename(abspath, outputPath); err != nil { + bail(1, "unable to move zip into place: %v", err) + } + log_info.Printf("moved zip archive to %v", outputPath) }