Closed carlreinke closed 3 years ago
Please check my comment in https://github.com/dotnet/runtime/issues/1908#issuecomment-852440826.
Thinking more about approved (https://github.com/dotnet/runtime/issues/24271#issuecomment-849816518) API I am sure it will work well in PowerShell.
We need to make a conclusion about implementation of target resolving since ReparsePointTag list is open and new tags can be introduced:
So this doesn't trouble me anymore; I will be content to carry around my own static file provider as long as necessary; however a good test for your own symbolic link API would be fixing this: https://github.com/dotnet/aspnetcore/issues/2774 ; the bug is due to calling new FileInfo() and getting back a length of 0 and not serving any data; should be a trivial fix if your symbolic link API is right.
Edit by @carlossanlop: Revisited API Proposal
Original proposal:
Rationale
The ability to interact with symbolic links (symlinks) in .NET is currently limited to determining that a file is
ReparsePoint
. This proposed API provides the ability to identify, read, and create symbolic links.Proposed API
Details
The path returned from
GetSymbolicLinkTargetPath(string)
/SymbolicLinkTargetPath
will be returned exactly as it is stored in the symbolic link. It may reference a non-existent file or directory.For the purposes of this API, NTFS Junction Points are considered to be like Linux bind mounts and are not considered to be symbolic links.
Updates
GetSymbolicLinkTargetPath
andIsSymbolicLink
fromPath
toDirectory
,DirectoryInfo
,File
andFileInfo
.CreateSymbolicLink
.path
tolinkPath
where a link file's path is desired.FileSystemInfo
base class.