summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/Content/ContentCache.cs2
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentHelper.cs11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs
index cbb6c1e9..736ee5da 100644
--- a/src/SMAPI/Framework/Content/ContentCache.cs
+++ b/src/SMAPI/Framework/Content/ContentCache.cs
@@ -76,7 +76,7 @@ namespace StardewModdingAPI.Framework.Content
{
key = this.NormalizePathSeparators(key);
return key.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase)
- ? key.Substring(0, key.Length - 4)
+ ? key[..^4]
: key;
}
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
index 94a30bf1..3c2441e8 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
@@ -118,6 +118,17 @@ namespace StardewModdingAPI.Framework.ModHelpers
switch (source)
{
case ContentSource.GameContent:
+ if (assetName.Name.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase))
+ {
+ assetName = this.ContentCore.ParseAssetName(assetName.Name[..^4], allowLocales: true);
+ SCore.DeprecationManager.Warn(
+ this.Mod,
+ "loading assets from the Content folder with a .xnb file extension",
+ "3.14.0",
+ DeprecationLevel.Notice
+ );
+ }
+
return this.GameContentManager.LoadLocalized<T>(assetName, this.CurrentLocaleConstant, useCache: false);
case ContentSource.ModFolder: