Add a new `isWindows` static method to the `Platform` class that returns `true` when the host operating system name equals "Windows". This provides a less stringly-typed API compared to checking `Platform.name` directly. The implementation is a simple delegation to the existing `name` foreign method, comparing it against the "Windows" string. Includes a test that verifies `Platform.isWindows` is equivalent to `Platform.name == "Windows"`.
5 lines
169 B
Plaintext
5 lines
169 B
Plaintext
import "os" for Platform
|
|
|
|
// It's just a less stringly-typed API for checking the name.
|
|
System.print(Platform.isWindows == (Platform.name == "Windows")) // expect: true
|