-
Notifications
You must be signed in to change notification settings - Fork 47
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
findFile
edges case with absolute paths on Windows
#72
Comments
What do you consider the correct behavior to be? The documentation is rather underspecified currently. I double-checked the results on my Linux system and there is at least one inconsistency between platforms that needs to be remedied:
|
Proposed invariant: If Currently these two cases from above violate the proposed invariant on Windows.
I expect the first to return |
@Rufflewind, do you mind showing the ghci output on Linux corresponding to |
The slash type is significant in Linux (tested on Ubuntu 16.04). May be affecting the results you're seeing.
In any case, I recommend the same invariant. |
|
Have you found any other cases that violate the invariant? |
Oh, sorry, it seems I have misread. I thought there was a discrepancy between Windows and Linux, but that was a mistake on my part. It seems the behavior that you are proposing concerns solely with regard to cases where the first argument is
I feel like the first behavior may have been accidental and not part of the original API: it only worked because In isolation, the first behavior is quite absurd, so I think a compromise would be: isAbsolute p ==> findFile [] p == bool (Just p) Nothing <$> doesFileExist p This should minimize the effect on most code except those that rely on
|
The examples below where
findFile
returnsNothing
are surprising, and if possible I think they should return the obvious path.The text was updated successfully, but these errors were encountered: