escape backwards slash for windows files with replace

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2024-03-19 16:00:40 -06:00
parent 2a00a02a2e
commit 5172edd2b2

View file

@ -1,13 +1,13 @@
package test
import (
"path/filepath"
"runtime"
"strings"
)
func NormalizeRelativePath(posixPath string) string {
if runtime.GOOS == "windows" {
return filepath.FromSlash(posixPath)
return strings.ReplaceAll(posixPath, "/", "\\")
}
return posixPath
}