mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Platform.isWindows.
This commit is contained in:
@ -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.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
class Platform {
|
||||
foreign static isPosix
|
||||
foreign static name
|
||||
|
||||
static isWindows { name == "Windows" }
|
||||
}
|
||||
|
||||
class Process {
|
||||
|
||||
@ -3,6 +3,8 @@ static const char* osModuleSource =
|
||||
"class Platform {\n"
|
||||
" foreign static isPosix\n"
|
||||
" foreign static name\n"
|
||||
"\n"
|
||||
" static isWindows { name == \"Windows\" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"class Process {\n"
|
||||
|
||||
4
test/os/platform/is_windows.wren
Normal file
4
test/os/platform/is_windows.wren
Normal file
@ -0,0 +1,4 @@
|
||||
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
|
||||
Reference in New Issue
Block a user