예제 #1
0
 private IEnumerable <IDirectory> GetExistingDirectories() =>
 _fileSystem.InputPaths
 .Select(x => _fileSystem.GetRootDirectory(x.Combine(Path)))
 .Where(x => x.Exists);
 /// <summary>
 /// Gets matching files based on globbing patterns from the root path or absolute paths.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="patterns">The globbing patterns and/or absolute paths.</param>
 /// <returns>
 /// All files in the specified directory that match the globbing patterns and/or absolute paths.
 /// </returns>
 public static IEnumerable <IFile> GetFiles(this IReadOnlyFileSystem fileSystem, IEnumerable <string> patterns)
 {
     _ = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
     return(fileSystem.GetFiles(fileSystem.GetRootDirectory(), patterns));
 }
 /// <summary>
 /// Gets all absolute input directories.
 /// </summary>
 /// <returns>The absolute input directories.</returns>
 public static IEnumerable <IDirectory> GetInputDirectories(this IReadOnlyFileSystem fileSystem)
 {
     _ = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
     return(fileSystem.InputPaths.Select(x => fileSystem.GetRootDirectory(x)).ToImmutableArray());
 }
 /// <summary>
 /// Gets a directory representing a root directory.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <returns>A root directory.</returns>
 public static IDirectory GetRootDirectory(this IReadOnlyFileSystem fileSystem) =>
 fileSystem.GetRootDirectory(NormalizedPath.Null);