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.
master
Jordan Orelli 3 years ago
parent 953ffbdef4
commit 5e951ab46a

@ -96,5 +96,10 @@ func zipcmd(args []string) {
bail(1, "zip not created: %v", err) bail(1, "zip not created: %v", err)
} }
// filepath.IsAbs
log_info.Printf("created zip archive at %v", abspath) 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)
} }

Loading…
Cancel
Save