Skip to content

Commit

Permalink
IFileInfo.Name is nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkoshevoi committed Nov 19, 2021
1 parent 8fa2aa3 commit 2ed875d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override string ToString()

private void Load(bool reload)
{
IFileInfo? file = Source.FileProvider?.GetFileInfo(Source.Path ?? string.Empty);
IFileInfo? file = Source.FileProvider?.GetFileInfo(Source.Path!);
if (file == null || !file.Exists)
{
if (Source.Optional || reload) // Always optional on reload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public partial interface IFileInfo
bool IsDirectory { get; }
System.DateTimeOffset LastModified { get; }
long Length { get; }
string Name { get; }
string? Name { get; }
string? PhysicalPath { get; }
System.IO.Stream CreateReadStream();
}
Expand All @@ -36,12 +36,12 @@ public NotFoundDirectoryContents() { }
}
public partial class NotFoundFileInfo : Microsoft.Extensions.FileProviders.IFileInfo
{
public NotFoundFileInfo(string name) { }
public NotFoundFileInfo(string? name) { }
public bool Exists { get { throw null; } }
public bool IsDirectory { get { throw null; } }
public System.DateTimeOffset LastModified { get { throw null; } }
public long Length { get { throw null; } }
public string Name { get { throw null; } }
public string? Name { get { throw null; } }
public string? PhysicalPath { get { throw null; } }
[System.Diagnostics.CodeAnalysis.DoesNotReturn]
public System.IO.Stream CreateReadStream() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface IFileInfo
/// <summary>
/// The name of the file or directory, not including any path.
/// </summary>
string Name { get; }
string? Name { get; }

/// <summary>
/// When the file was last modified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class NotFoundFileInfo : IFileInfo
/// Initializes an instance of <see cref="NotFoundFileInfo"/>.
/// </summary>
/// <param name="name">The name of the file that could not be found</param>
public NotFoundFileInfo(string name)
public NotFoundFileInfo(string? name)
{
Name = name;
}
Expand All @@ -42,7 +42,7 @@ public NotFoundFileInfo(string name)
public long Length => -1;

/// <inheritdoc />
public string Name { get; }
public string? Name { get; }

/// <summary>
/// Always null.
Expand Down

0 comments on commit 2ed875d

Please sign in to comment.