diff --git a/etlas/Distribution/Client/PackageDescription/Dhall.hs b/etlas/Distribution/Client/PackageDescription/Dhall.hs index bd9cf77..dee1ad9 100644 --- a/etlas/Distribution/Client/PackageDescription/Dhall.hs +++ b/etlas/Distribution/Client/PackageDescription/Dhall.hs @@ -20,7 +20,7 @@ import qualified Distribution.PackageDescription.Parsec as Cabal.Parse import Distribution.PackageDescription.Parse as Cabal.Parse (readGenericPackageDescription , parseGenericPackageDescription, ParseResult(..)) #endif -import Distribution.Simple.Utils (die', info) +import Distribution.Simple.Utils (die', info, createDirectoryIfMissingVerbose) import Distribution.PackageDescription import Distribution.Types.Dependency import Distribution.Types.ForeignLib @@ -89,6 +89,7 @@ writeDerivedCabalFile :: Verbosity -> FilePath writeDerivedCabalFile verbosity dir genPkg = do let path = dir "etlas.dhall.cabal" info verbosity $ "Writing derived cabal file from dhall file: " ++ path + createDirectoryIfMissingVerbose verbosity True dir writeGenericPackageDescription path genPkg return path diff --git a/etlas/Distribution/Client/SetupWrapper.hs b/etlas/Distribution/Client/SetupWrapper.hs index 388e3b4..6eb679d 100644 --- a/etlas/Distribution/Client/SetupWrapper.hs +++ b/etlas/Distribution/Client/SetupWrapper.hs @@ -64,7 +64,7 @@ import Distribution.Client.JobControl import Distribution.Simple.Utils ( die', notice, info, infoNoWrap, cabalVersion, tryFindPackageDesc ) import Distribution.Client.Utils - ( inDir, withExtraPathEnv, withEnv ) + ( inDir, withExtraPathEnv, withEnv, makeAbsoluteToCwd ) -- #ifdef mingw32_HOST_OS -- , canonicalizePathNoThrow -- #endif @@ -90,7 +90,7 @@ import Distribution.Simple.Utils ( withTempDirectory ) import Control.Exception ( bracket ) import qualified System.Win32 as Win32 -import System.FilePath ( takeDirectory, (<.>) ) +import System.FilePath ( takeDirectory, (<.>), isAbsolute ) import System.Directory ( doesDirectoryExist ) #endif @@ -388,8 +388,8 @@ setupWrapper :: Verbosity setupWrapper verbosity options mgenPkg mpkg cmd flags extraArgs = do setup <- getSetup verbosity options mgenPkg mpkg - existEtlasDhallFile <- doesFileExist $ - (fromMaybe "." (useWorkingDir options)) "etlas.dhall" + let currentDir = fromMaybe "." (useWorkingDir options) + existEtlasDhallFile <- doesFileExist $ currentDir "etlas.dhall" let flags' = flags $ setupVersion setup needDerivedCabalFile = setupMethod setup == SelfExecMethod && commandName cmd == "configure" @@ -399,10 +399,12 @@ setupWrapper verbosity options mgenPkg mpkg cmd flags extraArgs = do cabalFileArg <- if needDerivedCabalFile then do - let dir = useDistPref options + let distDir = useDistPref options + dir = if isAbsolute distDir then distDir else currentDir distDir genPkg = setupGenericPackage setup cabalFilePath <- writeDerivedCabalFile verbosity dir genPkg - return ["--cabal-file", cabalFilePath] + absCabalFilePath <- makeAbsoluteToCwd cabalFilePath + return ["--cabal-file", absCabalFilePath] else return [] let extraArgs' = extraArgs ++ cabalFileArg