// Only here for mocking/stubbing file system junk public IEnumerable <string> FindFiles(string directory, FileSet searchSpecification) { var excluded = searchSpecification.ExcludedFilesFor(directory); var files = searchSpecification.IncludedFilesFor(directory).ToList(); files.RemoveAll(excluded.Contains); return(files); }
private void scan(string root, string directory, FileSet fileSet, Action<FileFound> onFound, IEnumerable<string> excludes) { if (alreadyScannedOrNonexistent(directory)) { return; } _scannedDirectories.Add(directory); _fileSystem.ChildDirectoriesFor(directory) .Each(dir => scan(root, dir, fileSet, onFound, excludes)); var included = fileSet.IncludedFilesFor(directory).ToList(); var excluded = included.Where(x => excludes.Any(x.Contains)); var files = included.Except(excluded).ToList(); files.Each(file => onFound(new FileFound(file, root, directory))); }
// Only here for mocking/stubbing file system junk public IEnumerable <string> FindFiles(string directory, FileSet searchSpecification) { return(searchSpecification.IncludedFilesFor(directory)); }