-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cf5c68
commit ca88823
Showing
3 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace JuliaInterface | ||
{ | ||
public abstract class OperatingEnvironment | ||
{ | ||
|
||
public OperatingEnvironment() { } | ||
|
||
public abstract string GetWhereExe(); | ||
public abstract string TrimJuliaPath(string s); | ||
|
||
public static OperatingEnvironment GetEnvironment(){ | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
return new WindowsEnvironment(); | ||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
return new LinuxEnvironment(); | ||
else throw new Exception("Unsupported Operating System!"); | ||
} | ||
} | ||
|
||
public class WindowsEnvironment : OperatingEnvironment | ||
{ | ||
|
||
public override string GetWhereExe() => "where.exe"; | ||
|
||
public override string TrimJuliaPath(string s) => s.Substring(0, s.Length - 10); | ||
} | ||
|
||
public class LinuxEnvironment : OperatingEnvironment | ||
{ | ||
public override string GetWhereExe() => "which"; | ||
|
||
public override string TrimJuliaPath(string s) => s; | ||
} | ||
|
||
|
||
} |