Merge pull request #58 from eagletmt/correct-path
Don't change the current directory
This commit is contained in:
commit
31507eec7a
21
Cabal.hs
21
Cabal.hs
@ -39,13 +39,11 @@ initializeGHC opt fileName ghcOptions logging = withCabal ||> withoutCabal
|
||||
exts = map (addX . Gap.extensionToString) exts'
|
||||
lang = maybe "-XHaskell98" (addX . show) mlang
|
||||
gopts = ghcOptions ++ exts ++ [lang]
|
||||
changeToCabalDirectory cdir
|
||||
let idirs = case idirs' of
|
||||
idirs = case idirs' of
|
||||
[] -> [cdir,owdir]
|
||||
dirs -> dirs ++ [owdir]
|
||||
file = ajustFileName fileName owdir cdir
|
||||
dirs -> map (cdir </>) dirs ++ [owdir]
|
||||
logReader <- initSession opt gopts idirs logging
|
||||
return (file,logReader)
|
||||
return (fileName,logReader)
|
||||
addX = ("-X" ++)
|
||||
|
||||
----------------------------------------------------------------
|
||||
@ -69,19 +67,6 @@ extractBuildInfo binfo = (hsSourceDirs binfo
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
ajustFileName :: FilePath -> FilePath -> FilePath -> FilePath
|
||||
ajustFileName name olddir newdir
|
||||
| olen == nlen = name
|
||||
| otherwise = drop (nlen+1) olddir </> name
|
||||
where
|
||||
olen = length olddir
|
||||
nlen = length newdir
|
||||
|
||||
changeToCabalDirectory :: FilePath -> Ghc ()
|
||||
changeToCabalDirectory dir = do
|
||||
liftIO $ setCurrentDirectory dir
|
||||
workingDirectoryChanged
|
||||
|
||||
-- CurrentWorkingDir, CabalDir, CabalFile
|
||||
getDirs :: IO (FilePath,FilePath,FilePath)
|
||||
getDirs = do
|
||||
|
Loading…
Reference in New Issue
Block a user