dotnet / dotnet/dotnet-api-docs

Should IFileInfo's PhysicalPath always be null?

Open
#7,699 7 comments 0 reactions 0 assignees View on GitHub
area-Extensions-FileSystem Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Except for the `PhysicalFileInfo` implementation from the `PhysicalFileProvider`, it seems like `IFileInfo`'s `PhysicalPath` should always be null, especially when the implementation type doesn't use a physical file system.

This seems to be the case for known implementations like your own `ManifestEmbeddedFileProvider`'s `ManifestFileInfo`; and the expectation for a custom implementation like a possible `ZipArchiveFileProvider`'s `ZipEntryFileInfo` based on your `ZipArchive` and `ZipEntry`.

If this is the case, it would be nice to document this understanding... I suspect it's too late to suggest exposing `PhysicalPath` _only_ on the `PhysicalFileInfo`.

https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.fileproviders.ifileinfo.physicalpath?view=dotnet-plat-ext-6.0#microsoft-extensions-fileproviders-ifileinfo-physicalpath

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.