Open tmds opened 1 year ago
Tagging subscribers to this area: @dotnet/area-system-io See info in area-owners.md if you want to be subscribed.
Author: | tmds |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.IO`, `untriaged` |
Milestone: | - |
cc @eerhardt @stephentoub @carlossanlop @adamsitnik
@tmds Windows offers a very similar set of file types, perhaps we should just call the enum FileType
and make it work on every OS?
Can you share some links to the related Windows API docs?
https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfiletype gives some.
For differentiating reparse points https://learn.microsoft.com/en-us/windows/win32/fileio/determining-whether-a-directory-is-a-volume-mount-point?source=recommendations
It may be the enumeration will need some Windows-specific entries as well.
https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags
Cc @jeremykuhne
Can you share some links to the related Windows API docs?
@danmoseley provided the right links, we are already using GetFileType
in SFH
:
I can see that Windows maps FILE_TYPE_PIPE
to not only socket but also anonymous and named pipes. We could most probably check the file path to see if it's a pipe (they all start with \\.\pipe\
) and use this hacky way.
I've just looked through these docs, and I wonder if it makes sense to put these in a single enum.
I think the main use-case of UnixFileType
is to identify files found in a file system, for example: while enumerating.
Because GetFileType
takes a handle, I assume it is more used when already having a handle and for example verifying the type for some operation. The types returned are probably not (commonly) found on a Windows file system.
The reparse point type use-cases seem similar to the UnixFileType
, but the lack of overlap doesn't encourage to put them in a single enum
.
Background and motivation
Make it possible for getting Unix file types.
Sometimes it is desired to identify certain types of files. .NET uses an internal enum for this.
This proposal provides a public API, similar in style as the one added for unix file modes in .NET 7.
API Proposal
API Usage
Alternative Designs
No response
Risks
No response