Skip to content

Commit

Permalink
normalize windows input path
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed May 25, 2024
1 parent 16fd7b8 commit e01f0da
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"log"
"os"
"path/filepath"
"runtime"
"strings"
)

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e01f0da

Please sign in to comment.