module Idris.Info
( getIdrisLibDir
, getIdrisFlagsLib
, getIdrisFlagsInc
, getIdrisFlagsEnv
, getIdrisCC
, getIdrisVersion
, getIdrisVersionNoGit
, getIdrisUserDataDir
, getIdrisInitScript
, getIdrisHistoryFile
, getIdrisInstalledPackages
, getIdrisLoggingCategories
) where
import System.FilePath
import System.Directory
import Data.Version
import Idris.Imports (installedPackages)
import Idris.AbsSyntax (loggingCatsStr)
import qualified IRTS.System as S
import Version_idris (gitHash)
import Paths_idris
getIdrisLibDir :: IO String
getIdrisLibDir = S.getIdrisLibDir
getIdrisFlagsLib :: IO [String]
getIdrisFlagsLib = S.getLibFlags
getIdrisFlagsInc :: IO [String]
getIdrisFlagsInc = S.getIncFlags
getIdrisFlagsEnv :: IO [String]
getIdrisFlagsEnv = S.getEnvFlags
getIdrisCC :: IO String
getIdrisCC = S.getCC
getIdrisVersion = showVersion S.version ++ suffix
where
suffix = if gitHash =="" then "" else "-" ++ gitHash
getIdrisVersionNoGit = S.version
getIdrisUserDataDir :: IO FilePath
getIdrisUserDataDir = getAppUserDataDirectory "idris"
getIdrisInitScript :: IO FilePath
getIdrisInitScript = do
idrisDir <- getIdrisUserDataDir
return $ idrisDir </> "repl" </> "init"
getIdrisHistoryFile :: IO FilePath
getIdrisHistoryFile = do
udir <- getIdrisUserDataDir
return (udir </> "repl" </> "history")
getIdrisInstalledPackages :: IO [String]
getIdrisInstalledPackages = installedPackages
getIdrisLoggingCategories :: IO [String]
getIdrisLoggingCategories = return $ words loggingCatsStr