@@ -11,23 +11,32 @@ public partial class __default
11
11
// returns one of : MacOS, Windows, Unix, Other
12
12
public static icharseq GetOsShort ( )
13
13
{
14
- if ( System . OperatingSystem . IsMacOS ( ) )
14
+ // PlatformID.MacOSX doesn't actually work
15
+ String osDesc = System . Runtime . InteropServices . RuntimeInformation . OSDescription ;
16
+ if ( osDesc . Contains ( "Darwin" ) )
15
17
{
16
18
return charseq . FromString ( "MacOS" ) ;
17
19
}
18
- if ( System . OperatingSystem . IsWindows ( ) )
20
+ OperatingSystem os = Environment . OSVersion ;
21
+ PlatformID pid = os . Platform ;
22
+ switch ( pid )
19
23
{
20
- return charseq . FromString ( "Windows" ) ;
24
+ case PlatformID . Win32NT :
25
+ case PlatformID . Win32S :
26
+ case PlatformID . Win32Windows :
27
+ case PlatformID . WinCE :
28
+ return charseq . FromString ( "Windows" ) ;
29
+ break ;
30
+ case PlatformID . Unix :
31
+ return charseq . FromString ( "Unix" ) ;
32
+ break ;
33
+ case PlatformID . MacOSX :
34
+ return charseq . FromString ( "MacOS" ) ;
35
+ break ;
36
+ default :
37
+ return charseq . FromString ( "Other" ) ;
38
+ break ;
21
39
}
22
- if ( System . OperatingSystem . IsLinux ( ) )
23
- {
24
- return charseq . FromString ( "Unix" ) ;
25
- }
26
- if ( System . OperatingSystem . IsFreeBSD ( ) )
27
- {
28
- return charseq . FromString ( "Unix" ) ;
29
- }
30
- return charseq . FromString ( "Other" ) ;
31
40
}
32
41
33
42
// returns one of : Java, Dotnet, Go, Python, Rust
0 commit comments