/// <summary>
        /// Gets a file representing an input.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="path">
        /// The path of the input file. If this is an absolute path,
        /// then a file representing the specified path is returned.
        /// If it's a relative path, then operations will search all
        /// current input paths.
        /// </param>
        /// <returns>An input file.</returns>
        public static IFile GetInputFile(this IReadOnlyFileSystem fileSystem, NormalizedPath path)
        {
            _ = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            path.ThrowIfNull(nameof(path));

            if (path.IsRelative)
            {
                IFile notFound = null;
                foreach (NormalizedPath inputPath in fileSystem.InputPaths.Reverse())
                {
                    IFile file = fileSystem.GetFile(fileSystem.RootPath.Combine(inputPath).Combine(path));
                    if (notFound == null)
                    {
                        notFound = file;
                    }
                    if (file.Exists)
                    {
                        return(file);
                    }
                }
                if (notFound == null)
                {
                    throw new InvalidOperationException("The input paths collection must have at least one path");
                }
                return(notFound);
            }
            return(fileSystem.GetFile(path));
        }
 /// <summary>
 /// Gets a file representing a root file.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="path">
 /// The path of the root file. If this is an absolute path,
 /// then a file representing the specified path is returned.
 /// If it's a relative path, then it will be combined with the
 /// current root path.
 /// </param>
 /// <returns>A root file.</returns>
 public static IFile GetRootFile(this IReadOnlyFileSystem fileSystem, NormalizedPath path)
 {
     _ = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
     return(fileSystem.GetFile(fileSystem.RootPath.Combine(path)));
 }