From e01f0da6c269b445314253b2274b4777b3f3f64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Sat, 25 May 2024 23:29:16 +0200 Subject: [PATCH] normalize windows input path --- cmd/root.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 70c9a74..7ad9818 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -13,6 +13,7 @@ import ( "log" "os" "path/filepath" + "runtime" "strings" ) @@ -68,6 +69,12 @@ func init() { } serverDir = absServerDir + if runtime.GOOS == "windows" { + // normalize lower case windows path + // e.g. c:\MCServers to C:\MCServers + serverDir = strings.ToUpper(serverDir[0:1]) + serverDir[1:] + } + // -- server-file serverFile = strings.TrimSpace(serverFile) if serverFile != "" && serverFile != filepath.Base(serverFile) { @@ -186,8 +193,11 @@ func handleArgs(input string, version string, serverDir string, host string) (*m archivePath = file } else if files.IsFile(input) { - log.Printf("Installing from mrpack file: %s", input) archivePath = input + if runtime.GOOS == "windows" { + archivePath = strings.ToUpper(archivePath[0:1]) + archivePath[1:] + } + log.Printf("Installing from mrpack file: %s\n", archivePath) } else { log.Printf("Trying to resolve project id or slug: %s\n", input)