From f8d3d1410c1d7a115f7fd8818254104d05f5f085 Mon Sep 17 00:00:00 2001
From: Duncan Coutts <duncan@community.haskell.org>
Date: Mon, 28 Mar 2016 16:06:03 +0100
Subject: [PATCH] Correct path handling for package dirs in project files

Both relative and absolute paths. That is, things like:

packages: this/
          ~/hacking/that/
---
 cabal-install/Distribution/Client/ProjectConfig.hs | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/cabal-install/Distribution/Client/ProjectConfig.hs b/cabal-install/Distribution/Client/ProjectConfig.hs
index 050191e15a..5a93b9fd52 100644
--- a/cabal-install/Distribution/Client/ProjectConfig.hs
+++ b/cabal-install/Distribution/Client/ProjectConfig.hs
@@ -610,8 +610,7 @@ findProjectPackages projectRootDir ProjectConfig{..} = do
       case () of
         _ | isDir
          -> do let dirname = filename -- now we know its a dir
-                   glob    = globStarDotCabal pkglocstr
-               matches <- matchFileGlob projectRootDir glob
+               matches <- matchFileGlob dirname globStarDotCabal
                case matches of
                  [match]
                      -> return (Right (ProjectPackageLocalDirectory
@@ -638,12 +637,9 @@ findProjectPackages projectRootDir ProjectConfig{..} = do
                       && takeExtension (dropExtension f) == ".tar"
 
 
-globStarDotCabal :: FilePath -> FilePathGlob
+globStarDotCabal :: FilePathGlob
 globStarDotCabal =
-    FilePathGlob FilePathRelative
-  . foldr (\dirpart -> GlobDir [Literal dirpart])
-          (GlobFile [WildCard, Literal ".cabal"])
-  . splitDirectories
+    FilePathGlob FilePathRelative (GlobFile [WildCard, Literal ".cabal"])
 
 
 --TODO: [code cleanup] use sufficiently recent transformers package
-- 
GitLab