chore: don't and slash prefix just for windows abs path

This commit is contained in:
Noah Hsu
2022-06-28 22:22:02 +08:00
parent 505b126888
commit 8a0915ffb1
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package utils
import (
stdpath "path"
"path/filepath"
"runtime"
"strings"
)
@ -10,7 +11,7 @@ import (
func StandardizePath(path string) string {
path = strings.TrimSuffix(path, "/")
// abs path
if filepath.IsAbs(path) {
if filepath.IsAbs(path) && runtime.GOOS == "windows" {
return path
}
// relative path with prefix '..'