diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs | 27 |
2 files changed, 23 insertions, 5 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 118cc441..86ba5e49 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -32,6 +32,7 @@ * Fixed input suppression not working consistently for clicks. * Fixed console command input not saved to the log. * Fixed `helper.ModRegistry.GetApi` interface validation errors not mentioning which interface caused the issue. + * Fixed some common non-mod build output being included in release zip. * **Breaking changes** (see [migration guide](https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.3)): * Dropped some deprecated APIs. * `LocationEvents` have been rewritten (see above). diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs index ba2e671d..3fec8215 100644 --- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs +++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs @@ -73,11 +73,7 @@ namespace StardewModdingAPI.ModBuildConfig.Framework continue; // ignore release zips - if (this.EqualsInvariant(file.Extension, ".zip")) - continue; - - // ignore Json.NET (bundled into SMAPI) - if (this.EqualsInvariant(file.Name, "Newtonsoft.Json.dll") || this.EqualsInvariant(file.Name, "Newtonsoft.Json.xml")) + if (this.ShouldIgnore(file)) continue; // add file @@ -145,6 +141,27 @@ namespace StardewModdingAPI.ModBuildConfig.Framework /********* ** Private methods *********/ + /// <summary>Get whether a build output file should be ignored.</summary> + /// <param name="file">The file info.</param> + private bool ShouldIgnore(FileInfo file) + { + return + // release zips + this.EqualsInvariant(file.Extension, ".zip") + + // Json.NET (bundled into SMAPI) + || this.EqualsInvariant(file.Name, "Newtonsoft.Json.dll") + || this.EqualsInvariant(file.Name, "Newtonsoft.Json.xml") + + // code analysis files + || file.Name.EndsWith(".CodeAnalysisLog.xml", StringComparison.InvariantCultureIgnoreCase) + || file.Name.EndsWith(".lastcodeanalysissucceeded", StringComparison.InvariantCultureIgnoreCase) + + // OS metadata files + || this.EqualsInvariant(file.Name, ".DS_Store") + || this.EqualsInvariant(file.Name, "Thumbs.db"); + } + /// <summary>Get a case-insensitive dictionary matching the given JSON.</summary> /// <param name="json">The JSON to parse.</param> private IDictionary<string, object> Parse(string json) |