Skip to content

Commit

Permalink
Add support for Haiku
Browse files Browse the repository at this point in the history
  • Loading branch information
trungnt2910 committed Aug 18, 2023
1 parent 62d3e89 commit 79010f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Cli/Microsoft.DotNet.Cli.Utils/RuntimeEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ internal enum Platform
Darwin = 3,
FreeBSD = 4,
illumos = 5,
Solaris = 6
Solaris = 6,
Haiku = 7
}

internal static class RuntimeEnvironment
Expand Down Expand Up @@ -45,6 +46,8 @@ private static string GetOSName()
return GetDistroId() ?? nameof(Platform.illumos);
case Platform.Solaris:
return nameof(Platform.Solaris);
case Platform.Haiku:
return nameof(Platform.Haiku);
default:
return nameof(Platform.Unknown);
}
Expand All @@ -67,6 +70,8 @@ private static string GetOSVersion()
// RuntimeInformation.OSDescription example on Solaris 11.3: SunOS 5.11 11.3
// we only need the major version; 11
return RuntimeInformation.OSDescription.Split(' ')[2].Split('.')[0];
case Platform.Haiku:
return Environment.OSVersion.Version.ToString(1);
default:
return string.Empty;
}
Expand Down Expand Up @@ -251,6 +256,10 @@ private static Platform DetermineOSPlatform()
{
return Platform.Solaris;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("HAIKU")))
{
return Platform.Haiku;
}
#endif

return Platform.Unknown;
Expand Down
11 changes: 11 additions & 0 deletions src/Layout/redist/PortableRuntimeIdentifierGraph.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@
"unix-x64"
]
},
"haiku": {
"#import": [
"unix"
]
},
"haiku-x64": {
"#import": [
"haiku",
"unix-x64"
]
},
"illumos": {
"#import": [
"unix"
Expand Down

0 comments on commit 79010f6

Please sign in to comment.