summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/ContentPack.cs3
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModHelper.cs5
3 files changed, 6 insertions, 3 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 597fe0e5..f6498f06 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -16,6 +16,7 @@
* Fixed unhelpful error when a mod exposes a non-public API.
* Fixed input events being raised for keyboard buttons when a textbox is receiving input.
* Fixed some JSON field names being case-sensitive.
+ * Fixed `helper.ReadJsonFile` and `helper.WriteJsonFile` not normalising path separators.
* For SMAPI developers:
* Overhauled mod DB format to be more concise, reduce the memory footprint, and support versioning/defaulting more fields.
diff --git a/src/SMAPI/Framework/ContentPack.cs b/src/SMAPI/Framework/ContentPack.cs
index 0a8f223e..071fb872 100644
--- a/src/SMAPI/Framework/ContentPack.cs
+++ b/src/SMAPI/Framework/ContentPack.cs
@@ -3,6 +3,7 @@ using System.IO;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI.Framework.Serialisation;
+using StardewModdingAPI.Framework.Utilities;
using xTile;
namespace StardewModdingAPI.Framework
@@ -52,7 +53,7 @@ namespace StardewModdingAPI.Framework
/// <returns>Returns the deserialised model, or <c>null</c> if the file doesn't exist or is empty.</returns>
public TModel ReadJsonFile<TModel>(string path) where TModel : class
{
- path = Path.Combine(this.DirectoryPath, path);
+ path = Path.Combine(this.DirectoryPath, PathUtilities.NormalisePathSeparators(path));
return this.JsonHelper.ReadJsonFile<TModel>(path);
}
diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
index c73dc307..07dada7e 100644
--- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using StardewModdingAPI.Framework.Serialisation;
+using StardewModdingAPI.Framework.Utilities;
namespace StardewModdingAPI.Framework.ModHelpers
{
@@ -108,7 +109,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
public TModel ReadJsonFile<TModel>(string path)
where TModel : class
{
- path = Path.Combine(this.DirectoryPath, path);
+ path = Path.Combine(this.DirectoryPath, PathUtilities.NormalisePathSeparators(path));
return this.JsonHelper.ReadJsonFile<TModel>(path);
}
@@ -119,7 +120,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
public void WriteJsonFile<TModel>(string path, TModel model)
where TModel : class
{
- path = Path.Combine(this.DirectoryPath, path);
+ path = Path.Combine(this.DirectoryPath, PathUtilities.NormalisePathSeparators(path));
this.JsonHelper.WriteJsonFile(path, model);
}