seems to work...

This commit is contained in:
Nox Sluijtman 2024-03-09 02:52:59 +01:00
parent 2fbde34568
commit 261d1c6264
3 changed files with 15 additions and 7 deletions

View file

@ -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