feat: add Platform.isWindows static method to check for Windows OS

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"`.
This commit is contained in:
Bob Nystrom
2016-05-21 19:53:21 +00:00
parent 67bf74777c
commit 7768d1c9cd
4 changed files with 12 additions and 0 deletions
+4
View File
@@ -24,3 +24,7 @@ If Wren was compiled for an unknown operating system, returns "Unknown".
Returns `true` if the host operating system is known to support the POSIX
standard. This is true for Linux and other Unices, as well as the various Apple
operating systems.
### **isWindows**
Returns `true` if the host operating system is some flavor of Windows.