seems to work...
This commit is contained in:
parent
2fbde34568
commit
261d1c6264
3 changed files with 15 additions and 7 deletions
|
@ -1,8 +1,10 @@
|
|||
module Main where
|
||||
|
||||
import System.IO
|
||||
import System.Directory
|
||||
import Options.Applicative
|
||||
import Data.List
|
||||
import Control.Exception
|
||||
|
||||
data CgiState = CgiSuccess
|
||||
instance Show CgiState where
|
||||
|
@ -76,3 +78,9 @@ mkIndex True d f =
|
|||
in do
|
||||
line <- trim . words . head . lines <$> readFile path
|
||||
putStrLn $ "=> " ++ path ++ " " ++ line
|
||||
|
||||
getFirstLine :: FilePath -> IO (Maybe String)
|
||||
getFirstLine f = (Just <$> readFile f) `catch` handler
|
||||
where
|
||||
handler :: IOException -> IO (Maybe String)
|
||||
handler _ = return Nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue