From eef6a9c2e8d124ad0856a8b351f9cae68e54f6eb Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 2 May 2021 18:34:26 -0400 Subject: add support for dot-ignoring local map tilesheet files (#732) --- src/SMAPI/Framework/ContentManagers/ModContentManager.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/SMAPI/Framework') diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 0cd431e8..f32e3be6 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -317,6 +317,15 @@ namespace StardewModdingAPI.Framework.ContentManagers return true; } + // special case: local filenames starting with a dot should be ignored + // For example, this lets mod authors have a '.spring_town.png' file in their map folder so it can be + // opened in Tiled, while still mapping it to the vanilla 'Maps/spring_town' asset at runtime. + { + string filename = Path.GetFileName(relativePath); + if (filename.StartsWith(".")) + relativePath = Path.Combine(Path.GetDirectoryName(relativePath) ?? "", filename.TrimStart('.')); + } + // get relative to map file { string localKey = Path.Combine(modRelativeMapFolder, relativePath); -- cgit