-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOblockingMarks issues that we want to fast track in order to unblock other important workMarks issues that we want to fast track in order to unblock other important work
Milestone
Description
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
public class Directory
{
public static DirectoryInfo CreateSymbolicLink(string linkPath, string targetPath);
public static string GetSymbolicLinkTargetPath(string linkPath);
public static bool IsSymbolicLink(string path);
}
public class File
{
public static FileInfo CreateSymbolicLink(string linkPath, string targetPath);
public static string GetSymbolicLinkTargetPath(string linkPath);
public static bool IsSymbolicLink(string path);
}
public class FileSystemInfo
{
public bool IsSymbolicLink { get; }
public string SymbolicLinkTargetPath { get; }
public void CreateSymbolicLink(string linkPath);
}
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
- Move
GetSymbolicLinkTargetPath
andIsSymbolicLink
fromPath
toDirectory
,DirectoryInfo
,File
andFileInfo
. - Add
CreateSymbolicLink
. - Split from Proposed API for canonical paths #23871.
- Change
path
tolinkPath
where a link file's path is desired. - Move the APIs to the
FileSystemInfo
base class.
worldbeater, jnm2, AraHaan, ThomasPiskol, Erikvl87 and 46 more
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.IOblockingMarks issues that we want to fast track in order to unblock other important workMarks issues that we want to fast track in order to unblock other important work