module Idris.Info
( getIdrisDataDir
, getIdrisCRTSDir
, getIdrisJSRTSDir
, getIdrisLibDir
, getIdrisDocDir
, getIdrisFlagsLib
, getIdrisFlagsInc
, getIdrisFlagsEnv
, getIdrisCC
, getIdrisVersion
, getIdrisVersionNoGit
, getIdrisUserDataDir
, getIdrisInitScript
, getIdrisHistoryFile
, getIdrisInstalledPackages
, getIdrisLoggingCategories
, getIdrisDataFileByName
) where
import Idris.Imports (installedPackages)
import Idris.Options (loggingCatsStr)
import qualified IRTS.System as S
import Paths_idris
import Version_idris (gitHash)
import Data.Version
import System.Directory
import System.FilePath
getIdrisDataDir :: IO String
getIdrisDataDir = S.getIdrisDataDir
getIdrisCRTSDir :: IO String
getIdrisCRTSDir = S.getIdrisCRTSDir
getIdrisJSRTSDir :: IO String
getIdrisJSRTSDir = S.getIdrisJSRTSDir
getIdrisDocDir :: IO String
getIdrisDocDir = S.getIdrisDocDir
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
getIdrisDataFileByName :: String -> IO FilePath
getIdrisDataFileByName = S.getIdrisDataFileByName