Skip to content

Fix file globbing with multiple dots (#784) #1343

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cabal/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ import Control.Monad
import Control.Concurrent.MVar
( newEmptyMVar, putMVar, takeMVar )
import Data.List
( nub, unfoldr, isPrefixOf, tails, intercalate )
( nub, unfoldr, isPrefixOf, isSuffixOf, tails, intercalate )
import Data.Char as Char
( toLower, chr, ord )
import Data.Bits
Expand Down Expand Up @@ -716,12 +716,12 @@ matchDirFileGlob dir filepath = case parseFileGlob filepath of
++ " name, not in the directory name or file extension."
++ " If a wildcard is used it must be with an file extension."
Just (NoGlob filepath') -> return [filepath']
Just (FileGlob dir' ext) -> do
Just (FileGlob dir' globExt) -> do
files <- getDirectoryContents (dir </> dir')
case [ dir' </> file
| file <- files
, let (name, ext') = splitExtensions file
, not (null name) && ext' == ext ] of
, let (name, fileExt) = splitExtensions file
, not (null name) && globExt `isSuffixOf` fileExt ] of
[] -> die $ "filepath wildcard '" ++ filepath
++ "' does not match any files."
matches -> return matches
Expand Down