Make getSystemLibDir use GHC.Paths
instead of running ghc
This commit is contained in:
parent
b8f9498f83
commit
d1da6ab289
@ -24,22 +24,18 @@ import Data.Maybe (isJust, fromJust)
|
|||||||
import Exception (ghandle, SomeException(..))
|
import Exception (ghandle, SomeException(..))
|
||||||
import GHC (Ghc, GhcMonad, DynFlags(..), GhcLink(..), HscTarget(..), LoadHowMuch(..))
|
import GHC (Ghc, GhcMonad, DynFlags(..), GhcLink(..), HscTarget(..), LoadHowMuch(..))
|
||||||
import qualified GHC as G
|
import qualified GHC as G
|
||||||
|
import GHC.Paths (libdir)
|
||||||
import qualified Language.Haskell.GhcMod.Gap as Gap
|
import qualified Language.Haskell.GhcMod.Gap as Gap
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
import System.Exit (exitSuccess)
|
import System.Exit (exitSuccess)
|
||||||
import System.IO (hPutStr, hPrint, stderr)
|
import System.IO (hPutStr, hPrint, stderr)
|
||||||
import System.IO.Unsafe (unsafePerformIO)
|
import System.IO.Unsafe (unsafePerformIO)
|
||||||
import System.Process (readProcess)
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- | Obtaining the directory for system libraries.
|
-- | Obtaining the directory for system libraries.
|
||||||
getSystemLibDir :: IO (Maybe FilePath)
|
getSystemLibDir :: IO (Maybe FilePath)
|
||||||
getSystemLibDir = do
|
getSystemLibDir = return $ Just libdir
|
||||||
res <- readProcess "ghc" ["--print-libdir"] []
|
|
||||||
return $ case res of
|
|
||||||
"" -> Nothing
|
|
||||||
dirn -> Just (init dirn)
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user