tgstation-server 6.0.1
The /tg/station 13 server suite
Loading...
Searching...
No Matches
DotnetHelper.cs
Go to the documentation of this file.
1#if NET6_0_OR_GREATER
2using System;
3using System.Collections.Generic;
4using System.IO;
5using System.Linq;
6#endif
7
9{
10#if NET6_0_OR_GREATER
14 public static class DotnetHelper
15 {
21 public static IEnumerable<string> GetPotentialDotnetPaths(bool isWindows)
22 {
23 var enviromentPath = Environment.GetEnvironmentVariable("PATH");
24 var paths = enviromentPath.Split(';');
25
26 var exeName = "dotnet";
27 IEnumerable<string> enumerator;
28 if (isWindows)
29 {
30 exeName += ".exe";
31 enumerator = new List<string>(paths)
32 {
33 "C:/Program Files/dotnet",
34 "C:/Program Files (x86)/dotnet",
35 };
36 }
37 else
38 enumerator = paths
39 .Select(x => x.Split(':'))
40 .SelectMany(x => x)
41 .Concat(new List<string>(2)
42 {
43 "/usr/bin",
44 "/usr/share/bin",
45 "/usr/local/share/dotnet",
46 });
47
48 enumerator = enumerator.Select(x => Path.Combine(x, exeName));
49
50 return enumerator;
51 }
52 }
53#endif
54}