diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI.Installer/InteractiveInstaller.cs | 15 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/DataHelper.cs | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 68ef3d71..b7bd7b53 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -13,6 +13,7 @@ For modders: * Asset propagation for player sprites now affects other players' sprites, and updates recolor maps (e.g. sleeves). * Removed invalid-schedule validation which had false positives. + * Fixed `helper.Data.Read/WriteGlobalData` using the `Saves` folder. The installer will move existing folders to the appdata folder. For SMAPI/tool developers: * Updated links for the new r/SMAPI subreddit. diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 964300ac..14f37258 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -373,6 +373,21 @@ namespace StardewModdingApi.Installer this.InteractivelyDelete(path); } + // move global save data folder (changed in 3.2) + { + string dataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley"); + DirectoryInfo oldDir = new DirectoryInfo(Path.Combine(dataPath, "Saves", ".smapi")); + DirectoryInfo newDir = new DirectoryInfo(Path.Combine(dataPath, ".smapi")); + + if (oldDir.Exists) + { + if (newDir.Exists) + this.InteractivelyDelete(oldDir.FullName); + else + oldDir.MoveTo(newDir.FullName); + } + } + /**** ** Install new files ****/ diff --git a/src/SMAPI/Framework/ModHelpers/DataHelper.cs b/src/SMAPI/Framework/ModHelpers/DataHelper.cs index 3d43c539..6cde849c 100644 --- a/src/SMAPI/Framework/ModHelpers/DataHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/DataHelper.cs @@ -177,7 +177,7 @@ namespace StardewModdingAPI.Framework.ModHelpers private string GetGlobalDataPath(string key) { this.AssertSlug(key, nameof(key)); - return Path.Combine(Constants.SavesPath, ".smapi", "mod-data", this.ModID.ToLower(), $"{key}.json".ToLower()); + return Path.Combine(Constants.DataPath, ".smapi", "mod-data", this.ModID.ToLower(), $"{key}.json".ToLower()); } /// <summary>Assert that a key contains only characters that are safe in all contexts.</summary> |