1. my class IO::Spec {
  2. my %module = # only list the non-Unix ones in lowercase
  3. 'mswin32' => 'Win32',
  4. 'os2' => 'Win32',
  5. 'dos' => 'Win32',
  6. 'symbian' => 'Win32',
  7. 'netware' => 'Win32',
  8. 'win32' => 'Win32',
  9. 'cygwin' => 'Cygwin',
  10. 'qnx' => 'QNX',
  11. 'nto' => 'QNX',
  12. # <MacOS Mac> »=>» 'Mac',
  13. # 'VMS' => 'VMS'
  14. ;
  15. method select(IO::Spec:U: $token? is copy) {
  16. # really just a way of getting $*DISTRO.name before we have %*ENV
  17. $token //=
  18. nqp::p6box_s(nqp::atkey(nqp::backendconfig(), 'osname'));
  19. IO::Spec::{%module{ lc $token } // 'Unix'};
  20. }
  21. }
  22. # temporary non-lazy initialization of $*SPEC
  23. PROCESS::<$SPEC> = IO::Spec.select;