summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-02-19 20:22:01 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-02-19 20:22:01 -0500
commitb6cc17112d95345de83348dd918ed1f7711926f4 (patch)
tree3581dd8c2fd5fdff8bfcdf277e7a8815d739325d /src/SMAPI/Framework
parentc38c2b2c41b97ae7f7e46a4010107221a0e47c91 (diff)
downloadSMAPI-b6cc17112d95345de83348dd918ed1f7711926f4.tar.gz
SMAPI-b6cc17112d95345de83348dd918ed1f7711926f4.tar.bz2
SMAPI-b6cc17112d95345de83348dd918ed1f7711926f4.zip
normalise path separators in read/write JSON file methods exposed to mods
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/ContentPack.cs3
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModHelper.cs5
2 files changed, 5 insertions, 3 deletions
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);
}