From e77f78a21e3fc5f2ffea75aa949c88e378096089 Mon Sep 17 00:00:00 2001 From: donomii Date: Sun, 13 Nov 2022 18:22:54 +0100 Subject: [PATCH] Better unpacking --- packages-windows/dcss-git.json | 8 -------- packages-windows/go-1.10.3.json | 9 --------- updater.go | 19 +++++++------------ 3 files changed, 7 insertions(+), 29 deletions(-) delete mode 100644 packages-windows/dcss-git.json delete mode 100644 packages-windows/go-1.10.3.json diff --git a/packages-windows/dcss-git.json b/packages-windows/dcss-git.json deleted file mode 100644 index 48968bb..0000000 --- a/packages-windows/dcss-git.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Name" : "DCSS", - "Zip" : "", - "Url" : "https://github.com/crawl/crawl", - "Fetch" : "git", - "Branch" : "master", - "Plan" : "cmake" -} diff --git a/packages-windows/go-1.10.3.json b/packages-windows/go-1.10.3.json deleted file mode 100644 index 9bceb4c..0000000 --- a/packages-windows/go-1.10.3.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Name" : "go", - "Zip" : "go1.13.4.windows-amd64.zip", - "Url" : "https://dl.google.com/go/go1.13.4.windows-amd64.zip", - "Fetch" : "web", - "Plan" : "zipWithDirectory", - "Type" : "application", - "BinDir": "/bin" -} diff --git a/updater.go b/updater.go index ed7932a..1e05678 100644 --- a/updater.go +++ b/updater.go @@ -251,19 +251,13 @@ func makeOpt(optName, optVal string) string { } func unTar(b Config, zipPath string) { - p2 := strings.Replace(zipPath, ".gz", "", -1) - p2 = strings.Replace(zipPath, ".tgz", ".tar", -1) - p2 = strings.Replace(p2, ".lzma", "", -1) - p2 = strings.Replace(p2, ".bz2", "", -1) - splits := strings.Split(p2, "/") + zipPath = strings.ReplaceAll(zipPath, "\\", "/") + splits := strings.Split(zipPath, "/") fname := splits[len(splits)-1] if _, err := os.Stat(zipPath); err == nil { - if isWindows() { - unSevenZ(b, zipPath) - } else { - doCommand("tar", []string{"-xzvf", zipPath}) - doCommand("tar", []string{"-xjvf", zipPath}) - } + unSevenZ(b, zipPath) + doCommand("tar", []string{"-xzvf", zipPath, "--force-local"}) + doCommand("tar", []string{"-xjvf", zipPath, "--force-local"}) } else { log.Println("Could not find ", fname) } @@ -279,7 +273,8 @@ func unTgzLib(b Config, zipPath string) { //unSevenZ(b, fname) } else { - doCommand("tar", []string{"-xzvf", zipPath}) + doCommand("tar", []string{"-xzvf", zipPath, "--force-local"}) + doCommand("tar", []string{"-xjvf", zipPath, "--force-local"}) } } else { log.Println("Could not extract ", fname)