Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Path.isLink #450

Open
1 task done
WillDaSilva opened this issue Oct 3, 2021 · 8 comments
Open
1 task done

[FEATURE] Path.isLink #450

WillDaSilva opened this issue Oct 3, 2021 · 8 comments
Labels
feature request Discussion about a new feature

Comments

@WillDaSilva
Copy link
Contributor

Is there an existing issue for this?

  • 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

@WillDaSilva WillDaSilva added the feature request Discussion about a new feature label Oct 3, 2021
@Kishore-abhimanyu
Copy link

Can you assign me this issue. I would like to contribute to this?

@Jason2605
Copy link
Member

Done @Kishore-abhimanyu !

@Kishore-abhimanyu
Copy link

@Jason2605 Can you share some test cases for this?

@Jason2605
Copy link
Member

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.

@WillDaSilva
Copy link
Contributor Author

@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.

@Jason2605
Copy link
Member

@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.

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.

@Kishore-abhimanyu
Copy link

will add the windows functionality also

@liz3
Copy link
Contributor

liz3 commented Oct 31, 2024

#754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Discussion about a new feature
Projects
None yet
Development

No branches or pull requests

4 participants