Dictu
Dictu copied to clipboard
[FEATURE] `Path.isLink`
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem?
The Path library does not have a method to check if a given path is symbolic link.
Describe the solution you'd like
A Path.isLink method that takes a single string argument, the path, and returns a bool indicating whether it is or is not a symbolic link.
Describe alternatives you've considered
Could also be called Path.isSymLink, which is more accurate, but more verbose.
Additional context
No response
Can you assign me this issue. I would like to contribute to this?
Done @Kishore-abhimanyu !
@Jason2605 Can you share some test cases for this?
For testing the method is working for non-symbolic links just use any directory within the project. For testing symbolic links we may have to get a bit creative to appease the tests.
You do have System.platform available to you so that you can build the tests in a way that are platform related checking for symlinks that are there by default. Will have to do some research into finding these.
@Kishore-abhimanyu you'll have to write your own test cases. I would recommend creating a directory under tests/path that has a symlink to a regular file, a symlink to a directory, and a broken symlink. Note that git can commit symlinks. Then add the file tests/path/isLink.du, and use assert with Path.isLink to test against those symlinks and non-symlinks under tests/path.
@Kishore-abhimanyu you'll have to write your own test cases. I would recommend creating a directory under
tests/paththat has a symlink to a regular file, a symlink to a directory, and a broken symlink. Note that git can commit symlinks. Then add the filetests/path/isLink.du, and useassertwithPath.isLinkto test against those symlinks and non-symlinks undertests/path.
This may cause issues for windows machines. If i'm not mistaken (untested) a symlink created on say a unix machine and pulled down on a windows machine creates a text file rather than an actual symbolic link.
will add the windows functionality also