diff --git a/sugar/file.rkt b/sugar/file.rkt index 7be5380..36fce74 100644 --- a/sugar/file.rkt +++ b/sugar/file.rkt @@ -3,7 +3,7 @@ ;; this is identical to `filename-extension` in `racket/path` -;; but will not treat hidden files as an extension (which IMHO is a bug) +;; but will not treat hidden files as an extension (which is a bug) (define (filename-extension name) (let* ([name (file-name-from-path name)] [name (and name (path->bytes name))]) diff --git a/sugar/scribblings/file-extensions.scrbl b/sugar/scribblings/file-extensions.scrbl index c112fea..2a7ebd7 100644 --- a/sugar/scribblings/file-extensions.scrbl +++ b/sugar/scribblings/file-extensions.scrbl @@ -8,7 +8,7 @@ @title{File extensions} @defmodule[#:multi (sugar/file (submod sugar/file safe))] -These functions don't access the filesystem. +These functions don't access the filesystem. @bold{Warning}: these functions adopt the simplifying assumption that the paths are encoded as ASCII or UTF-8. A fully precise treatment of paths would need to handle them as byte strings. If you need that, see the functions in @racketmodname[racket/path]. This library will remain naive. Arguments that are @racket[pathish?] can take either a string or a path. For clarity below, I've used strings. @@ -30,10 +30,11 @@ Return the last file extension of @racket[_file-path] as a string, or @racket[#f [file-path pathish?] [ext stringish?]) boolean?] -Return @racket[#t] if the last file extension of @racket[_file-path] is @racket[_ext], otherwise @racket[#f]. +Return @racket[#t] if the last file extension of @racket[_file-path] is @racket[_ext], otherwise @racket[#f]. Not sensitive to case. @examples[#:eval my-eval (has-ext? "foo.txt" "txt") +(has-ext? "foo.txt" "TXT") (has-ext? "foo.txt" "jpg") (has-ext? "foo.jpg.txt" "jpg")]