don't change the current directory

This commit is contained in:
eagletmt 2012-03-19 16:36:54 +09:00
parent bf7d79773a
commit 3c2436ec82

View File

@ -39,13 +39,11 @@ initializeGHC opt fileName ghcOptions logging = withCabal ||> withoutCabal
exts = map (addX . Gap.extensionToString) exts' exts = map (addX . Gap.extensionToString) exts'
lang = maybe "-XHaskell98" (addX . show) mlang lang = maybe "-XHaskell98" (addX . show) mlang
gopts = ghcOptions ++ exts ++ [lang] gopts = ghcOptions ++ exts ++ [lang]
changeToCabalDirectory cdir idirs = case idirs' of
let idirs = case idirs' of
[] -> [cdir,owdir] [] -> [cdir,owdir]
dirs -> dirs ++ [owdir] dirs -> map (cdir </>) dirs ++ [owdir]
file = ajustFileName fileName owdir cdir
logReader <- initSession opt gopts idirs logging logReader <- initSession opt gopts idirs logging
return (file,logReader) return (fileName,logReader)
addX = ("-X" ++) 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 -- CurrentWorkingDir, CabalDir, CabalFile
getDirs :: IO (FilePath,FilePath,FilePath) getDirs :: IO (FilePath,FilePath,FilePath)
getDirs = do getDirs = do