diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI/Framework/ModAssemblyLoader.cs | 3 | ||||
-rw-r--r-- | src/StardewModdingAPI/Framework/Platform.cs | 12 | ||||
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 12 | ||||
-rw-r--r-- | src/StardewModdingAPI/StardewModdingAPI.csproj | 1 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs index f367c6a0..e5a73a8b 100644 --- a/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs +++ b/src/StardewModdingAPI/Framework/ModAssemblyLoader.cs @@ -25,8 +25,9 @@ namespace StardewModdingAPI.Framework *********/ /// <summary>Construct an instance.</summary> /// <param name="cacheDirPath">The cache directory.</param> + /// <param name="targetPlatform">The current game platform.</param> /// <param name="monitor">Encapsulates monitoring and logging for a given module.</param> - public ModAssemblyLoader(string cacheDirPath, IMonitor monitor) + public ModAssemblyLoader(string cacheDirPath, Platform targetPlatform, IMonitor monitor) { this.CacheDirPath = cacheDirPath; this.Monitor = monitor; diff --git a/src/StardewModdingAPI/Framework/Platform.cs b/src/StardewModdingAPI/Framework/Platform.cs new file mode 100644 index 00000000..cab81e06 --- /dev/null +++ b/src/StardewModdingAPI/Framework/Platform.cs @@ -0,0 +1,12 @@ +namespace StardewModdingAPI.Framework +{ + /// <summary>The game's platform version.</summary> + internal enum Platform + { + /// <summary>The Linux/Mac version of the game.</summary> + Mono, + + /// <summary>The Windows version of the game.</summary> + Windows + } +}
\ No newline at end of file diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index e364ef03..eba89981 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -23,13 +23,17 @@ namespace StardewModdingAPI /********* ** Properties *********/ - /// <summary>The full path to the Stardew Valley executable.</summary> + /// <summary>The target game platform.</summary> + private static readonly Platform TargetPlatform = #if SMAPI_FOR_WINDOWS - private static readonly string GameExecutablePath = Path.Combine(Constants.ExecutionPath, "Stardew Valley.exe"); + Platform.Windows; #else - private static readonly string GameExecutablePath = Path.Combine(Constants.ExecutionPath, "StardewValley.exe"); + Platform.Mono; #endif + /// <summary>The full path to the Stardew Valley executable.</summary> + private static readonly string GameExecutablePath = Path.Combine(Constants.ExecutionPath, Program.TargetPlatform == Platform.Windows ? "Stardew Valley.exe" : "StardewValley.exe"); + /// <summary>The full path to the folder containing mods.</summary> private static readonly string ModPath = Path.Combine(Constants.ExecutionPath, "Mods"); @@ -298,7 +302,7 @@ namespace StardewModdingAPI { Program.Monitor.Log("Loading mods..."); - ModAssemblyLoader modAssemblyLoader = new ModAssemblyLoader(Program.CachePath, Program.Monitor); + ModAssemblyLoader modAssemblyLoader = new ModAssemblyLoader(Program.CachePath, Program.TargetPlatform, Program.Monitor); foreach (string directory in Directory.GetDirectories(Program.ModPath)) { // ignore internal directory diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj index f3dbc45a..01be9a68 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.csproj +++ b/src/StardewModdingAPI/StardewModdingAPI.csproj @@ -217,6 +217,7 @@ <Compile Include="Framework\DeprecationManager.cs" /> <Compile Include="Framework\InternalExtensions.cs" /> <Compile Include="Framework\ModAssemblyLoader.cs" /> + <Compile Include="Framework\Platform.cs" /> <Compile Include="IModHelper.cs" /> <Compile Include="Framework\LogFileManager.cs" /> <Compile Include="LogLevel.cs" /> |