From 0d8009b231723ae337e3a22f7455cb5ce6a8e72e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 9 May 2017 22:37:05 -0400 Subject: fix installer finding redundant game paths on Linux --- src/StardewModdingAPI.Installer/InteractiveInstaller.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index 86e3d38a..52294c2e 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -30,7 +30,6 @@ namespace StardewModdingApi.Installer // Linux yield return $"{Environment.GetEnvironmentVariable("HOME")}/GOG Games/Stardew Valley/game"; yield return $"{Environment.GetEnvironmentVariable("HOME")}/.local/share/Steam/steamapps/common/Stardew Valley"; - yield return $"{Environment.GetEnvironmentVariable("HOME")}/.steam/steam/steamapps/common/Stardew Valley"; // Mac yield return "/Applications/Stardew Valley.app/Contents/MacOS"; -- cgit From 17ff230d8e7f7879337011babba4f65fae5d9bf8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 13 May 2017 15:14:32 -0400 Subject: streamline crossplatform build with Mono 5.0, update readme, tweak release notes --- README.md | 37 ++++++----- release-notes.md | 12 ++-- .../StardewModdingAPI.AssemblyRewriters.csproj | 24 +------ .../StardewModdingAPI.Installer.csproj | 10 +-- src/StardewModdingAPI.sln | 74 ++++++++++------------ src/StardewModdingAPI/StardewModdingAPI.csproj | 30 +-------- src/TrainerMod/TrainerMod.csproj | 6 +- src/prepare-install-package.targets | 3 +- 8 files changed, 76 insertions(+), 120 deletions(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/README.md b/README.md index 4eaba9b4..dcb4310f 100644 --- a/README.md +++ b/README.md @@ -59,35 +59,38 @@ section isn't relevant to you; see the previous sections to use or create mods._ ### Compiling from source Using an official SMAPI release is recommended for most users. -If you'd like to compile SMAPI from source, you can do that on any platform using -[Visual Studio](https://www.visualstudio.com/vs/community/) or [MonoDevelop](http://www.monodevelop.com/). -SMAPI uses build configuration derived from the [crosswiki mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) -to detect your current OS automatically and load the correct references. Compile output will be -placed in a `bin` folder at the root of the git repository. +SMAPI uses some C# 7 code, so you'll need at least +[Visual Studio 2017](https://www.visualstudio.com/vs/community/) on Windows, +[MonoDevelop 7.0](http://www.monodevelop.com/) on Linux, +[Visual Studio 2017 for Mac](https://www.visualstudio.com/vs/visual-studio-mac/), or an equivalent +IDE to compile it. It uses build configuration derived from the +[crossplatform mod config](https://github.com/Pathoschild/Stardew.ModBuildConfig#readme) to detect +your current OS automatically and load the correct references. Compile output will be placed in a +`bin` folder at the root of the git repository. ### Debugging a local build Rebuilding the solution in debug mode will copy the SMAPI files into your game folder. Starting -the `StardewModdingAPI` project with debugging will launch SMAPI with the debugger attached, so you -can intercept errors and step through the code being executed. +the `StardewModdingAPI` project with debugging from Visual Studio (on Mac or Windows) will launch +SMAPI with the debugger attached, so you can intercept errors and step through the code being +executed. This doesn't work in MonoDevelop on Linux, unfortunately. ### Preparing a release To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See -_[crossplatforming a SMAPI mod](http://canimod.com/guides/crossplatforming-a-smapi-mod#preparing-a-mod-release)_ -for the first-time setup. For simplicity, all paths are relative to the root of the repository (the -folder containing `src`). +[crossplatforming info](http://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod#Test_on_all_platforms) +on the wiki for the first-time setup. 1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a [semantic version](http://semver.org). Recommended format: build type | format | example :--------- | :-------------------------------- | :------ - dev build | `-alpha.` | `1.0.0-alpha.20171230` - beta | `-beta.`| `1.0.0-beta`, `1.0.0-beta.2`, … - release | `` | `1.0.0` + dev build | `-alpha.` | `1.0-alpha.20171230` + prerelease | `-prerelease.` | `1.0-prerelease.2` + release | `` | `1.0` 2. In Windows: 1. Rebuild the solution in _Release_ mode. - 2. Rename `bin/Packaged` to `SMAPI ` (e.g. `SMAPI 1.6`). + 2. Rename `bin/Packaged` to `SMAPI ` (e.g. `SMAPI 1.0`). 2. Transfer the `SMAPI ` folder to Linux or Mac. _This adds the installer executable and Windows files. We'll do the rest in Linux or Mac, since we need to set Unix file permissions that Windows won't save._ @@ -110,7 +113,8 @@ folder containing `src`). StardewModdingAPI.AssemblyRewriters.dll StardewModdingAPI.config.json StardewModdingAPI.exe - StardewModdingAPI.exe.mdb + StardewModdingAPI.pdb + StardewModdingAPI.xml steam_appid.txt System.Numerics.dll System.Runtime.Caching.dll @@ -129,7 +133,7 @@ folder containing `src`). 5. Copy & paste the `SMAPI ` folder as `SMAPI for developers`. 6. In the `SMAPI ` folder... * edit `internal/Mono/StardewModdingAPI.config.json` and - `internal/Windows/StardewModdingAPI.config.json` to disable developer mode; + `internal/Windows/StardewModdingAPI.config.json` to disable developer mode; * delete `internal/Windows/StardewModdingAPI.xml`. 7. Compress the two folders into `SMAPI .zip` and `SMAPI for developers.zip`. @@ -143,6 +147,7 @@ field | purpose `DeveloperMode` | Default `false` (except in _SMAPI for developers_ releases). Whether to enable features intended for mod developers. Currently this only makes `TRACE`-level messages appear in the console. `CheckForUpdates` | Default `true`. Whether SMAPI should check for a newer version when you load the game. If a new version is available, a small message will appear in the console. This doesn't affect the load time even if your connection is offline or slow, because it happens in the background. `ModCompatibility` | A list of mod versions SMAPI should consider compatible or broken regardless of whether it detects incompatible code. Each record can be set to `AssumeCompatible` or `AssumeBroken`. Changing this field is not recommended and may destabilise your game. +`VerboseLogging` | Whether SMAPI should log more information about the game context. ### Command-line arguments SMAPI recognises the following command-line arguments. These are intended for internal use or diff --git a/release-notes.md b/release-notes.md index f334a82f..0a10f57b 100644 --- a/release-notes.md +++ b/release-notes.md @@ -15,16 +15,16 @@ See [log](https://github.com/Pathoschild/SMAPI/compare/1.12...1.13). For players: * SMAPI now has better draw error recovery and detects when the error is irrecoverable. -* SMAPI now remembers if your game crashed and offers help next time you relaunch. +* SMAPI now remembers if your game crashed and offers help next time you launch it. * Fixed installer finding redundant game paths on Linux. * Fixed save events not being raised after the first day on Linux/Mac. -* Fixed error on Linux/Mac when a mod tries to load content immediately after the save is loaded. +* Fixed error on Linux/Mac when a mod loads a PNG immediately after the save is loaded. For mod developers: -* Added log entries for basic context changes (e.g. loaded save) to simplify troubleshooting. More detailed logging can be enabled by setting `VerboseLogging: true` in `StardewModdingAPI.config.json`. -* Added `debug` console command to TrainerMod which lets you pass debug commands to the game (e.g. `debug warp FarmHouse 1 1` warps the player to the farmhouse). -* Added a warning for mods that don't set the `UniqueID` manifest field, which will be required in SMAPI 2.0. -* Mods now implement `IDisposable` to let them release any unmanaged resources. +* Added log entries for basic context changes (e.g. loaded save) to simplify troubleshooting. +* Added a `debug` console command to TrainerMod which lets you pass debug commands to the game (e.g. `debug warp FarmHouse 1 1` warps the player to the farmhouse). +* Added a deprecation warning for mods that don't set the `UniqueID` manifest field, which will be required in SMAPI 2.0. +* Mods can now override `Dispose` if they need to release unmanaged resources. * Deprecated `GameEvents.GameLoaded` and `GameEvents.FirstUpdateTick`, since any logic in the mod's `Entry` method will happen after the game is loaded. ## 1.12 diff --git a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj index 775de9f2..e25b201e 100644 --- a/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj +++ b/src/StardewModdingAPI.AssemblyRewriters/StardewModdingAPI.AssemblyRewriters.csproj @@ -3,7 +3,7 @@ Debug - AnyCPU + x86 {10DB0676-9FC1-4771-A2C8-E2519F091E49} Library Properties @@ -12,7 +12,7 @@ v4.5 512 - + true full false @@ -21,7 +21,7 @@ prompt 4 - + pdbonly true bin\Release\ @@ -29,24 +29,6 @@ prompt 4 - - true - bin\x86\Debug\ - DEBUG;TRACE;SMAPI_FOR_WINDOWS - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE;SMAPI_FOR_WINDOWS - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll diff --git a/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj b/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj index 366e1c6e..765364dc 100644 --- a/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj +++ b/src/StardewModdingAPI.Installer/StardewModdingAPI.Installer.csproj @@ -3,7 +3,7 @@ Debug - AnyCPU + x86 {443DDF81-6AAF-420A-A610-3459F37E5575} Exe Properties @@ -13,8 +13,8 @@ 512 true - - AnyCPU + + x86 true full false @@ -23,8 +23,8 @@ prompt 4 - - AnyCPU + + x86 pdbonly true $(SolutionDir)\..\bin\Release\Installer diff --git a/src/StardewModdingAPI.sln b/src/StardewModdingAPI.sln index 57f94648..4bc72188 100644 --- a/src/StardewModdingAPI.sln +++ b/src/StardewModdingAPI.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.7 +VisualStudioVersion = 15.0.26430.4 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainerMod", "TrainerMod\TrainerMod.csproj", "{28480467-1A48-46A7-99F8-236D95225359}" EndProject @@ -38,54 +38,46 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {28480467-1A48-46A7-99F8-236D95225359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Debug|x86.ActiveCfg = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Debug|x86.Build.0 = Debug|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|Any CPU.Build.0 = Release|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|x86.ActiveCfg = Release|Any CPU - {28480467-1A48-46A7-99F8-236D95225359}.Release|x86.Build.0 = Release|Any CPU - {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28480467-1A48-46A7-99F8-236D95225359}.Debug|Any CPU.ActiveCfg = Debug|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Debug|x86.ActiveCfg = Debug|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Debug|x86.Build.0 = Debug|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Release|Any CPU.ActiveCfg = Release|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.Build.0 = Release|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Release|x86.ActiveCfg = Release|x86 + {28480467-1A48-46A7-99F8-236D95225359}.Release|x86.Build.0 = Release|x86 + {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.ActiveCfg = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Mixed Platforms.Build.0 = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.ActiveCfg = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.Build.0 = Debug|x86 - {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.Build.0 = Release|Any CPU + {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.ActiveCfg = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Mixed Platforms.ActiveCfg = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Mixed Platforms.Build.0 = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.ActiveCfg = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.Build.0 = Release|x86 - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Any CPU.Build.0 = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.ActiveCfg = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.Build.0 = Debug|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Any CPU.ActiveCfg = Release|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Any CPU.Build.0 = Release|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.ActiveCfg = Release|Any CPU - {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.Build.0 = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.ActiveCfg = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.Build.0 = Debug|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Any CPU.Build.0 = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.ActiveCfg = Release|Any CPU - {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.Build.0 = Release|Any CPU + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Any CPU.ActiveCfg = Debug|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.ActiveCfg = Debug|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Debug|x86.Build.0 = Debug|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Any CPU.ActiveCfg = Release|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|Mixed Platforms.Build.0 = Release|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.ActiveCfg = Release|x86 + {443DDF81-6AAF-420A-A610-3459F37E5575}.Release|x86.Build.0 = Release|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Any CPU.ActiveCfg = Debug|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.ActiveCfg = Debug|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Debug|x86.Build.0 = Debug|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Any CPU.ActiveCfg = Release|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|Mixed Platforms.Build.0 = Release|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.ActiveCfg = Release|x86 + {10DB0676-9FC1-4771-A2C8-E2519F091E49}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/StardewModdingAPI/StardewModdingAPI.csproj b/src/StardewModdingAPI/StardewModdingAPI.csproj index aec32560..2a150eb6 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.csproj +++ b/src/StardewModdingAPI/StardewModdingAPI.csproj @@ -3,7 +3,7 @@ Debug - AnyCPU + x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F} Exe Properties @@ -28,29 +28,6 @@ false true - - AnyCPU - true - full - true - $(SolutionDir)\..\bin\Debug\SMAPI - TRACE;DEBUG - prompt - 4 - false - true - - - AnyCPU - pdbonly - true - $(SolutionDir)\..\bin\Release\SMAPI - TRACE - prompt - 4 - false - true - x86 false @@ -268,9 +245,8 @@ - - - + + diff --git a/src/TrainerMod/TrainerMod.csproj b/src/TrainerMod/TrainerMod.csproj index 0bd667d4..191b7819 100644 --- a/src/TrainerMod/TrainerMod.csproj +++ b/src/TrainerMod/TrainerMod.csproj @@ -3,7 +3,7 @@ Debug - AnyCPU + x86 {28480467-1A48-46A7-99F8-236D95225359} Library Properties @@ -12,7 +12,7 @@ v4.5 512 - + true full true @@ -24,7 +24,7 @@ false true - + pdbonly true $(SolutionDir)\..\bin\Release\Mods\TrainerMod\ diff --git a/src/prepare-install-package.targets b/src/prepare-install-package.targets index ce257cc2..9a514abd 100644 --- a/src/prepare-install-package.targets +++ b/src/prepare-install-package.targets @@ -25,7 +25,8 @@ - + + -- cgit From def73fceaf2bff12b899d76a862ead6eb0f42199 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 18 May 2017 17:02:34 -0400 Subject: improve game install path detection --- release-notes.md | 2 +- .../InteractiveInstaller.cs | 50 +++++++++++++--------- src/crossplatform.targets | 1 + 3 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src/StardewModdingAPI.Installer') diff --git a/release-notes.md b/release-notes.md index 540efb48..641071e5 100644 --- a/release-notes.md +++ b/release-notes.md @@ -17,7 +17,7 @@ For players: * SMAPI now recovers better from mod draw errors and detects when the error is irrecoverable. * SMAPI now recovers automatically from errors in the game loop when possible. * SMAPI now remembers if your game crashed and offers help next time you launch it. -* Fixed installer finding redundant game paths on Linux. +* Fixed installer sometimes finding redundant game paths. * Fixed save events not being raised after the first day on Linux/Mac. * Fixed error on Linux/Mac when a mod loads a PNG immediately after the save is loaded. * Updated mod compatibility list for Stardew Valley 1.2. diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs index 52294c2e..01f7a01f 100644 --- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs +++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs @@ -27,31 +27,39 @@ namespace StardewModdingApi.Installer switch (platform) { case Platform.Mono: - // Linux - yield return $"{Environment.GetEnvironmentVariable("HOME")}/GOG Games/Stardew Valley/game"; - yield return $"{Environment.GetEnvironmentVariable("HOME")}/.local/share/Steam/steamapps/common/Stardew Valley"; + { + string home = Environment.GetEnvironmentVariable("HOME"); + + // Linux + yield return $"{home}/GOG Games/Stardew Valley/game"; + yield return Directory.Exists($"{home}/.steam/steam/steamapps/common/Stardew Valley") + ? $"{home}/.steam/steam/steamapps/common/Stardew Valley" + : $"{home}/.local/share/Steam/steamapps/common/Stardew Valley"; - // Mac - yield return "/Applications/Stardew Valley.app/Contents/MacOS"; - yield return $"{Environment.GetEnvironmentVariable("HOME")}/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS"; + // Mac + yield return "/Applications/Stardew Valley.app/Contents/MacOS"; + yield return $"{home}/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS"; + } break; case Platform.Windows: - // Windows - yield return @"C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley"; - yield return @"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"; - - // Windows registry - IDictionary registryKeys = new Dictionary - { - [@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150"] = "InstallLocation", // Steam - [@"SOFTWARE\WOW6432Node\GOG.com\Games\1453375253"] = "PATH", // GOG on 64-bit Windows - }; - foreach (var pair in registryKeys) { - string path = this.GetLocalMachineRegistryValue(pair.Key, pair.Value); - if (!string.IsNullOrWhiteSpace(path)) - yield return path; + // Windows + yield return @"C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley"; + yield return @"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"; + + // Windows registry + IDictionary registryKeys = new Dictionary + { + [@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150"] = "InstallLocation", // Steam + [@"SOFTWARE\WOW6432Node\GOG.com\Games\1453375253"] = "PATH", // GOG on 64-bit Windows + }; + foreach (var pair in registryKeys) + { + string path = this.GetLocalMachineRegistryValue(pair.Key, pair.Value); + if (!string.IsNullOrWhiteSpace(path)) + yield return path; + } } break; @@ -510,7 +518,7 @@ namespace StardewModdingApi.Installer // get installed paths DirectoryInfo[] defaultPaths = ( - from path in this.GetDefaultInstallPaths(platform).Distinct() + from path in this.GetDefaultInstallPaths(platform).Distinct(StringComparer.InvariantCultureIgnoreCase) let dir = new DirectoryInfo(path) where dir.Exists && dir.EnumerateFiles(executableFilename).Any() select dir diff --git a/src/crossplatform.targets b/src/crossplatform.targets index f28e005e..00b731eb 100644 --- a/src/crossplatform.targets +++ b/src/crossplatform.targets @@ -3,6 +3,7 @@ $(HOME)/GOG Games/Stardew Valley/game $(HOME)/.local/share/Steam/steamapps/common/Stardew Valley + $(HOME)/.steam/steam/steamapps/common/Stardew Valley /Applications/Stardew Valley.app/Contents/MacOS $(HOME)/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS -- cgit