public void MultipleIgnoreExpressions() { var ignoreList = new SourceSetIgnoreList(); ignoreList.Add(@".+\.tmp$"); ignoreList.Add(@".+\.log$"); ignoreList.IsIgnored(new SuiteRelativePath(@"a\b\c.dll.tmp")).Should().BeTrue(); ignoreList.IsIgnored(new SuiteRelativePath(@"x.log")).Should().BeTrue(); ignoreList.IsIgnored(new SuiteRelativePath(@"tmp")).Should().BeFalse(); }
/// <summary> /// Recursively adds every file in a given directory to a source set (<see cref="SourceSet"/>) /// </summary> /// <param name="target">The target source set to be extended</param> /// <param name="dir">The root directory for the operation</param> /// <param name="ignoreList">Ignore list for the target source set</param> private void AddAllFiles(SourceSet target, IFileSystemDirectory dir, SourceSetIgnoreList ignoreList) { foreach (var fileName in dir.Files) { var suiteRelativePath = new SuiteRelativePath(Path.Combine(suiteRoot.GetRelativePath(dir), fileName)); if (!ignoreList.IsIgnored(suiteRelativePath)) { target.Add(suiteRelativePath); } } foreach (var childDirectory in dir.ChildDirectories) { AddAllFiles(target, dir.GetChildDirectory(childDirectory), ignoreList); } }