From 5256b738b486aa1591c6b25b41410973f1feaf46 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 2 Aug 2021 21:14:22 -0400 Subject: use more reliable method to get save folder name SMAPI now tracks the actual folder name being loaded to avoid edge cases where the folder name doesn't match the save ID. --- src/SMAPI/Constants.cs | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'src/SMAPI/Constants.cs') diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 3877e17a..bfaee70e 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Reflection; using StardewModdingAPI.Enums; using StardewModdingAPI.Framework; @@ -165,6 +164,9 @@ namespace StardewModdingAPI /// The language code for non-translated mod assets. internal static LocalizedContentManager.LanguageCode DefaultLanguage { get; } = LocalizedContentManager.LanguageCode.en; + /// The name of the last save file loaded by the game. + internal static string LastRawSaveFileName { get; set; } + /********* ** Internal methods @@ -341,30 +343,9 @@ namespace StardewModdingAPI if (Context.LoadStage == LoadStage.None) return null; - // get basic info - string rawSaveName = Game1.GetSaveGameName(set_value: false); - ulong saveID = Context.LoadStage == LoadStage.SaveParsed - ? SaveGame.loaded.uniqueIDForThisGame - : Game1.uniqueIDForThisGame; - - // get best match (accounting for rare case where folder name isn't sanitized) - DirectoryInfo folder = null; - foreach (string saveName in new[] { rawSaveName, new string(rawSaveName.Where(char.IsLetterOrDigit).ToArray()) }) - { - try - { - folder = new DirectoryInfo(Path.Combine(Constants.SavesPath, $"{saveName}_{saveID}")); - if (folder.Exists) - return folder; - } - catch (ArgumentException) - { - // ignore invalid path - } - } - - // if save doesn't exist yet, return the default one we expect to be created - return folder; + // get save + string rawSaveName = Constants.LastRawSaveFileName; + return new DirectoryInfo(Path.Combine(Constants.SavesPath, rawSaveName)); } } } -- cgit From 1bb51b2c41bf5acdffb8e25c37187e9bdf9d3dd4 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 3 Aug 2021 19:11:26 -0400 Subject: prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 8 +++++--- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.ErrorHandler/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/SMAPI/Constants.cs') diff --git a/build/common.targets b/build/common.targets index d526a2bb..f2614998 100644 --- a/build/common.targets +++ b/build/common.targets @@ -1,7 +1,7 @@ - 3.12.0 + 3.12.1 SMAPI latest $(AssemblySearchPaths);{GAC} diff --git a/docs/release-notes.md b/docs/release-notes.md index 22eecc3a..16744b24 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,10 +1,12 @@ ← [README](README.md) # Release notes -## Upcoming release +## 3.12.1 +Released 03 August 2021 for Stardew Valley 1.5.4 or later. + * For players: - * The software conflict message added in SMAPI 3.11.0 now appears as a warning to simplify troubleshooting. - * Fixed error loading older Harmony mods for some players who launch the unofficial 64-bit Stardew Valley through Steam. + * The software conflict message is now shown as a warning to simplify troubleshooting. + * Fixed error loading older Harmony mods for some Windows players using unofficial 64-bit Stardew Valley. * Updated compatibility list. * For mod authors: diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index 09684f32..7023180b 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -1,9 +1,9 @@ { "Name": "Console Commands", "Author": "SMAPI", - "Version": "3.12.0", + "Version": "3.12.1", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.12.0" + "MinimumApiVersion": "3.12.1" } diff --git a/src/SMAPI.Mods.ErrorHandler/manifest.json b/src/SMAPI.Mods.ErrorHandler/manifest.json index c83ca3d0..8aa2a6a4 100644 --- a/src/SMAPI.Mods.ErrorHandler/manifest.json +++ b/src/SMAPI.Mods.ErrorHandler/manifest.json @@ -1,9 +1,9 @@ { "Name": "Error Handler", "Author": "SMAPI", - "Version": "3.12.0", + "Version": "3.12.1", "Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.", "UniqueID": "SMAPI.ErrorHandler", "EntryDll": "ErrorHandler.dll", - "MinimumApiVersion": "3.12.0" + "MinimumApiVersion": "3.12.1" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index 42f1af59..dbd65cbe 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.12.0", + "Version": "3.12.1", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.12.0" + "MinimumApiVersion": "3.12.1" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index bfaee70e..05800970 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -60,7 +60,7 @@ namespace StardewModdingAPI internal static int? LogScreenId { get; set; } /// SMAPI's current raw semantic version. - internal static string RawApiVersion = "3.12.0"; + internal static string RawApiVersion = "3.12.1"; } /// Contains SMAPI's constants and assumptions. -- cgit