Merge pull request #58 from eagletmt/correct-path

Don't change the current directory
This commit is contained in:
Kazu Yamamoto 2012-03-23 20:42:33 -07:00
commit 31507eec7a

View File

@ -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