diff --git a/Netkan/Validators/InstallsFilesValidator.cs b/Netkan/Validators/InstallsFilesValidator.cs index bb86fef45f..d97118faea 100644 --- a/Netkan/Validators/InstallsFilesValidator.cs +++ b/Netkan/Validators/InstallsFilesValidator.cs @@ -1,6 +1,8 @@ using System; using System.Linq; +using log4net; + using CKAN.NetKAN.Model; using CKAN.NetKAN.Services; using CKAN.Extensions; @@ -60,7 +62,26 @@ public void Validate(Metadata metadata) var badPaths = string.Join("\r\n", duplicates); throw new Kraken($"Multiple files attempted to install to:\r\n{badPaths}"); } + + // Not a perfect check (subject to false negatives) + // but better than nothing + if (mod.install != null) + { + var unmatchedIncludeOnlys = mod.install + .Where(stanza => stanza.include_only != null) + .SelectMany(stanza => stanza.include_only) + .Distinct() + .Where(incl => !allFiles.Any(f => f.Contains(incl))) + .ToList(); + if (unmatchedIncludeOnlys.Any()) + { + log.WarnFormat("No matches for includes_only: {0}", + string.Join(", ", unmatchedIncludeOnlys)); + } + } } } + + private static readonly ILog log = LogManager.GetLogger(typeof(InstallsFilesValidator)); } }