From 55fa8198ffc140237e1041056f3a4d8f4e7469c8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 27 May 2017 01:01:45 -0400 Subject: fix content API not matching XNB files with two dots (like 'a.b.xnb') if extension isn't specified --- src/StardewModdingAPI/Framework/ContentHelper.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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 /// The asset path relative to the mod folder. 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; } -- cgit