summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-20 22:18:57 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-07-20 22:18:57 -0400
commitc74702b027aeab927b4e038e440cbbb24d859cfd (patch)
tree5546cc0632d214181a5ac7e6a357d6d35f7fc658
parentdefa1b9a95c6bcb680bef3506ab94a71ed6189d6 (diff)
downloadSMAPI-c74702b027aeab927b4e038e440cbbb24d859cfd.tar.gz
SMAPI-c74702b027aeab927b4e038e440cbbb24d859cfd.tar.bz2
SMAPI-c74702b027aeab927b4e038e440cbbb24d859cfd.zip
fix error loading .xnb files from the local mod folder since SMAPI 3.0
-rw-r--r--docs/release-notes.md3
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs4
2 files changed, 6 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index bfea8bfb..fea93104 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -12,6 +12,9 @@
* Added error message if you manually install the wrong SMAPI bitness (e.g. 32-bit SMAPI with 64-bit game).
* Fixed intermittent error if a mod fetches mod-provided APIs asynchronously.
+* For mod authors:
+ * Fixed error loading `.xnb` files from the local mod folder since SMAPI 3.0.
+
## 3.11.0
Released 09 July 2021 for Stardew Valley 1.5.4 or later. See [release highlights](https://www.patreon.com/posts/53514295).
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index 4f6aa775..bc5a8b74 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -77,6 +77,8 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <inheritdoc />
public override T Load<T>(string assetName, LanguageCode language, bool useCache)
{
+ // normalize key
+ bool isXnbFile = Path.GetExtension(assetName).ToLower() == ".xnb";
assetName = this.AssertAndNormalizeAssetName(assetName);
// disable caching
@@ -108,7 +110,7 @@ namespace StardewModdingAPI.Framework.ContentManagers
try
{
// get file
- FileInfo file = this.GetModFile(assetName);
+ FileInfo file = this.GetModFile(isXnbFile ? $"{assetName}.xnb" : assetName); // .xnb extension is stripped from asset names passed to the content manager
if (!file.Exists)
throw GetContentError("the specified path doesn't exist.");