Skip to content

Commit

Permalink
Work around a bug in canonicalizePath
Browse files Browse the repository at this point in the history
It is not actually canonical for directories with vs without a trailing
slash. This bug is present in newer directory releases, older versions
work correctly.

Filed as haskell/directory#63
  • Loading branch information
dcoutts committed Nov 27, 2016
1 parent 9b856f6 commit 861cae7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cabal-install/Distribution/Client/BuildTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ import System.FilePath as FilePath
( takeExtension, dropExtension
, splitDirectories, joinPath, splitPath )
import System.Directory
( doesFileExist, doesDirectoryExist, canonicalizePath
, getCurrentDirectory )
( doesFileExist, doesDirectoryExist, getCurrentDirectory )
import qualified System.Directory (canonicalizePath)
import System.FilePath
( (</>), (<.>), normalise )
( (</>), (<.>), normalise, dropTrailingPathSeparator )
import Text.EditDistance
( defaultEditCosts, restrictedDamerauLevenshteinDistance )

Expand Down Expand Up @@ -1810,6 +1810,11 @@ matchInexactly cannonicalise key xs =
caseFold :: String -> String
caseFold = lowercase

-- | Workaround for <https://github.com/haskell/directory/issues/63>
canonicalizePath :: FilePath -> IO FilePath
canonicalizePath =
System.Directory.canonicalizePath . dropTrailingPathSeparator


------------------------------
-- Example inputs
Expand Down

0 comments on commit 861cae7

Please sign in to comment.