-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refine real path expansion logic #19
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We need to expand the path into its real path in order to correctly assess whether the file begins with a full stop. However, we only need to check this for Unix. We should probably add some tests on macOS and BSD in particular to see if our custom C calls and low-level functions still work without realpath at the top-most level, or if we need to call normpath as well.
For reasons described in updated documentation, the package/bundle check for macOS should also expand to real path. Implement tests to test that our functionality still works.
Some internal functions need to use the real path, where some don't. We check calculate the real path anyway, to ensure that the path exists, so we are now going to pass it around to the individual _ishidden-* functions for use as required.
For whatever reason, Julia < 1.2 on Windows does not error on realpath if the path does not exist. This is nonstandard behaviour, but the behaviour nonetheless. We need to try to construct the real path, and then manually check if the path exists.
TODO: change version number EDIT: resolved by 9d31a1b. |
jakewilliami
changed the title
Draft: Refine real path expansion logic
Refine real path expansion logic
Sep 27, 2022
jakewilliami
added a commit
that referenced
this pull request
Sep 27, 2022
Instead of keeping track of both the file given by the user _and_ the real path of the file (which some internal functions require, and others necessarily don't), we can construct a PathStruct object and pass that around internally. This also allows us to perform error checking within the PathStruct object, rather than in the ishidden function. Related: #19. Still to do: - Write documentation for PathStruct and InvaliidRealPathError - Implement further tests - Refine error checking for PathStruct constructor with method PathStruct(path::AbstractString, rp::AbstractString)
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We need to expand the path into its real path in order to correctly assess whether the file begins with a full stop. However, we only need to check this for Unix. As such, we should only expand this where needed.
The reason this is an important distinction to make is due to #18, in which I realised that
/tmp
expands to/private/tmp
on macOS, which is not a system file (despite/tmp
being one).We should probably add some tests on macOS and BSD in particular to see if our custom C calls and low-level functions still work without realpath at the top-most level, or if we need to call normpath as well.