24 lines
485 B
Go
24 lines
485 B
Go
// +build js,wasm
|
|
|
|
package fs
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
var checkedIfWindows bool
|
|
var cachedIfWindows bool
|
|
|
|
func CheckIfWindows() bool {
|
|
if !checkedIfWindows {
|
|
cachedIfWindows = false
|
|
|
|
// Hack: Assume that we're on Windows if we're running WebAssembly and
|
|
// the "C:\\" directory exists. This is a workaround for a bug in Go's
|
|
// WebAssembly support: https://github.com/golang/go/issues/43768.
|
|
_, err := os.Stat("C:\\")
|
|
cachedIfWindows = err == nil
|
|
}
|
|
|
|
return cachedIfWindows
|
|
}
|