diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-27 01:01:45 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-27 01:01:45 -0400 |
commit | 55fa8198ffc140237e1041056f3a4d8f4e7469c8 (patch) | |
tree | 28b0089b9b94e1fc79e7f64f5a3ec673e9b6656f /src | |
parent | e92dbc41df1548b72be4ca5c0a6c6fe17235d950 (diff) | |
download | SMAPI-55fa8198ffc140237e1041056f3a4d8f4e7469c8.tar.gz SMAPI-55fa8198ffc140237e1041056f3a4d8f4e7469c8.tar.bz2 SMAPI-55fa8198ffc140237e1041056f3a4d8f4e7469c8.zip |
fix content API not matching XNB files with two dots (like 'a.b.xnb') if extension isn't specified
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI/Framework/ContentHelper.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/StardewModdingAPI/Framework/ContentHelper.cs b/src/StardewModdingAPI/Framework/ContentHelper.cs index 14b6aa8f..7fd5e803 100644 --- a/src/StardewModdingAPI/Framework/ContentHelper.cs +++ b/src/StardewModdingAPI/Framework/ContentHelper.cs @@ -225,10 +225,18 @@ namespace StardewModdingAPI.Framework /// <param name="path">The asset path relative to the mod folder.</param> private FileInfo GetModFile(string path) { + // try exact match path = Path.Combine(this.ModFolderPath, this.ContentManager.NormalisePathSeparators(path)); FileInfo file = new FileInfo(path); - if (!file.Exists && file.Extension == "") - file = new FileInfo(Path.Combine(this.ModFolderPath, path + ".xnb")); + + // try with default extension + if (!file.Exists && file.Extension.ToLower() != ".xnb") + { + FileInfo result = new FileInfo(path + ".xnb"); + if (result.Exists) + file = result; + } + return file; } |