Files
wazero/internal/platform/path_windows.go
Crypt Keeper a9b3301862 gojs: implements remaining link functions (#1198)
This implements the last remaining link functions using the same logic
as WASI. In doing so, this changes the signature for FS.ReadLink to be
more similar to the rest of the functions. Particularly, it stops
reading the result into a buffer.

After this, the only syscalls left to implement in gojs are chown.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-05 16:11:36 +08:00

18 lines
418 B
Go

package platform
import "strings"
// ToPosixPath returns the input, converting any backslashes to forward ones.
func ToPosixPath(in string) string {
// strings.Map only allocates on change, which is good enough especially as
// path.Join uses forward slash even on windows.
return strings.Map(windowsToPosixSeparator, in)
}
func windowsToPosixSeparator(r rune) rune {
if r == '\\' {
return '/'
}
return r
}