2module Util.System(tempfile,environment,getCC,
3 getLibFlags,getIdrisLibDir,getIncFlags,rmFile) where
5-- System helper functions.
7import System.Directory (getTemporaryDirectory, removeFile)
8import System.FilePath ((</>), addTrailingPathSeparator, normalise)
9import System.Environment
11#if MIN_VERSION_base(4,0,0)
12import Control.Exception as CE
17#if MIN_VERSION_base(4,0,0)
18catchIO :: IO a -> (IOError -> IO a) -> IO a
25getCC = do env <- environment "IDRIS_CC"
27 Nothing -> return "gcc"
30tempfile :: IO (FilePath, Handle)
31tempfile = do dir <- getTemporaryDirectory
32 openTempFile (normalise dir) "idris"
34environment :: String -> IO (Maybe String)
35environment x = catchIO (do e <- getEnv x
37 (\_ -> return Nothing)
39rmFile :: FilePath -> IO ()
40rmFile f = do putStrLn $ "Removing " ++ f
41 catchIO (removeFile f)
42 (\ioerr -> putStrLn $ "WARNING: Cannot remove file "
43 ++ f ++ ", Error msg:" ++ show ioerr)
46getLibFlags = do dir <- getDataDir
47 return $ "-L" ++ (dir </> "rts") ++ " -lidris_rts -lgmp -lpthread"
49getIdrisLibDir = do dir <- getDataDir
50 return $ addTrailingPathSeparator dir
52getIncFlags = do dir <- getDataDir
53 return $ "-I" ++ dir </> "rts"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list