SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

Enable getting and deleting symbolic links

Open fbedoyao opened this issue 1 year ago • 1 comments

The current functions in the SftpClient class don’t support interacting with symbolic links directly. By adding an additional parameter, getRealPath, to the GetCanonicalPath function, we can get a reference to the symbolic link instead of a reference to the file that it points to. The default value for this parameter is set to true so that the original behavior is maintained for existing code.

The added functions GetSymbolicLink, SymbolicLinkExists, and DeleteSymbolicLink use GetCanonicalPath with getRealPath set to false to get and delete symbolic links.

fbedoyao avatar Aug 24 '23 19:08 fbedoyao

@fbedoyao It looks great. Can you add an integration test for those methods? Here you can find an example: https://github.com/sshnet/SSH.NET/blob/7cd0487785c82730ecfe277cb9964ab2e101a4af/src/Renci.SshNet.IntegrationTests/SftpClientTests.cs#L53

WojciechNagorski avatar Aug 30 '23 09:08 WojciechNagorski