github.com/gaukas/wazerofs@v0.1.0/sysfs/path_windows.go (about) 1 package sysfs 2 3 import "strings" 4 5 // toPosixPath returns the input, converting any backslashes to forward ones. 6 func toPosixPath(in string) string { 7 // strings.Map only allocates on change, which is good enough especially as 8 // path.Join uses forward slash even on windows. 9 return strings.Map(windowsToPosixSeparator, in) 10 } 11 12 func windowsToPosixSeparator(r rune) rune { 13 if r == '\\' { 14 return '/' 15 } 16 return r 17 }