diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-08-06 01:54:29 +0200 |
---|---|---|
committer | Daniel Gröber (dxld) <dxld@darkboxed.org> | 2019-09-17 17:48:26 +0200 |
commit | c70e8076803bd29d7675ed493ebb1ca246891b34 (patch) | |
tree | 1f8d279b2b0edc90cce2df08496e62f2a9b86130 /src | |
parent | fe57ad27c239a4eaf2401a9874182492fa9f3af9 (diff) |
Fix ProjLoc to source directory correspondence
We cannot always assume `takeDirectory cfg_file` will be the project source
directory!
Diffstat (limited to 'src')
-rw-r--r-- | src/CabalHelper/Compiletime/Types.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs index b30e107..748b8d1 100644 --- a/src/CabalHelper/Compiletime/Types.hs +++ b/src/CabalHelper/Compiletime/Types.hs @@ -32,6 +32,7 @@ import Data.IORef import Data.Version import Data.Typeable import GHC.Generics +import System.FilePath (takeDirectory) import System.Posix.Types import CabalHelper.Compiletime.Types.RelativePath import CabalHelper.Shared.InterfaceTypes @@ -146,7 +147,7 @@ data ProjLoc (pt :: ProjType) where -- configuration file then points to the packages that make up this -- project. This corresponds to the @--cabal-project=PATH@ flag on the -- @cabal@ command line. - ProjLocV2File :: { plCabalProjectFile :: !FilePath } -> ProjLoc ('Cabal 'CV2) + ProjLocV2File :: { plCabalProjectFile :: !FilePath, plProjectDirV2 :: !FilePath } -> ProjLoc ('Cabal 'CV2) -- | This is equivalent to 'ProjLocV2File' but using the default -- @cabal.project@ file name. @@ -164,6 +165,15 @@ plV1Dir :: ProjLoc ('Cabal 'CV1) -> FilePath plV1Dir ProjLocV1CabalFile {plProjectDirV1} = plProjectDirV1 plV1Dir ProjLocV1Dir {plProjectDirV1} = plProjectDirV1 +plCabalProjectDir :: ProjLoc ('Cabal cpt) -> FilePath +plCabalProjectDir ProjLocV1CabalFile {plProjectDirV1} = plProjectDirV1 +plCabalProjectDir ProjLocV1Dir {plProjectDirV1} = plProjectDirV1 +plCabalProjectDir ProjLocV2File {plProjectDirV2} = plProjectDirV2 +plCabalProjectDir ProjLocV2Dir {plProjectDirV2} = plProjectDirV2 + +plStackProjectDir :: ProjLoc 'Stack -> FilePath +plStackProjectDir ProjLocStackYaml {plStackYaml} = takeDirectory plStackYaml + projTypeOfProjLoc :: ProjLoc pt -> SProjType pt projTypeOfProjLoc ProjLocV1CabalFile{} = SCabal SCV1 projTypeOfProjLoc ProjLocV1Dir{} = SCabal SCV1 |