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
filename-extension
mishandles hidden files
#1307
Comments
I agree that (Aside: why "extension" versus "suffix"? The root of this mismatch is ancient history and reflected in the function name One possibility is to introduce |
Very good, thank you. BTW not to induce mission creep, but why do these functions treat the extension/suffix as a byte string? It seems peculiar when everything else is geared toward Unicode. #lang racket
(path->string (string->path "foo.λ"))
(filename-extension (string->path "foo.λ"))
> "foo.λ"
> #"\316\273" |
Unfortunately, paths are not composed of characters in general. On Unix variants, paths are composed of bytes. On Windows, they're composed of UTF-16 code units. Using a byte string accommodates both of those. |
Unfortunately, the name |
A hidden file starts with a dot, but
filename-extension
will treat its name as an extension:I would argue this is incorrect: that a filename extension is not merely a substring that starts with a dot, but a substring that starts with a dot and has some kind of filename in front of it (for which it serves as the extension).
Therefore, the fix would be to change the regexp pattern in the current
filename-extension
:To have a dot pattern at the front, like so:
Because then:
The text was updated successfully, but these errors were encountered: