From 34183f12b420f5ea91bd0a5681028f55d2fd4a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Wed, 3 Apr 2024 00:25:47 +0200 Subject: [PATCH] resolve absolute zip path --- cmd/root.go | 7 ++++++- cmd/update.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index e69ab5c..976059b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -105,8 +105,13 @@ var RootCmd = &cobra.Command{ } index, zipPath := handleArgs(input, version, serverDir, host) + zipPath, err := filepath.Abs(zipPath) + if err != nil { + log.Fatalln(err) + } + fmt.Printf("Installing %q from %q to %q\n", index.Name, zipPath, serverDir) - err := os.MkdirAll(serverDir, 0755) + err = os.MkdirAll(serverDir, 0755) if err != nil { log.Fatalln(err) } diff --git a/cmd/update.go b/cmd/update.go index 00a7dfb..9c31d83 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -6,6 +6,7 @@ import ( "github.com/nothub/mrpack-install/update/packstate" "github.com/spf13/cobra" "log" + "path/filepath" ) var ( @@ -60,6 +61,11 @@ var updateCmd = &cobra.Command{ index, zipPath := handleArgs(state.Slug, version, serverDir, host) + zipPath, err = filepath.Abs(zipPath) + if err != nil { + log.Fatalln(err) + } + update.Cmd(serverDir, dlThreads, dlRetries, index, zipPath, state) }, }