-
-
Notifications
You must be signed in to change notification settings - Fork 372
/
Spec.pm
34 lines (29 loc) · 929 Bytes
/
Spec.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
my class IO::Spec {
my %module = # only list the non-Unix ones in lowercase
'mswin32' => 'Win32',
'os2' => 'Win32',
'dos' => 'Win32',
'symbian' => 'Win32',
'netware' => 'Win32',
'win32' => 'Win32',
'cygwin' => 'Cygwin',
'qnx' => 'QNX',
'nto' => 'QNX',
# <MacOS Mac> »=>» 'Mac',
# 'VMS' => 'VMS'
;
method select(IO::Spec:U: $token? is copy) {
# really just a way of getting $*DISTRO.name before we have %*ENV
$token //=
#?if jvm
nqp::p6box_s(nqp::atkey(nqp::jvmgetproperties(), 'os.name'));
#?endif
#?if !jvm
nqp::p6box_s(nqp::atkey(nqp::backendconfig(), 'osname'));
#?endif
IO::Spec::{%module{ lc $token } // 'Unix'};
}
}
# temporary non-lazy initialization of $*SPEC
PROCESS::<$SPEC> = IO::Spec.select;
# vim: ft=perl6 expandtab sw=4