From 137b150cc334566541557fb0e9dd0e71824d2cb6 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Mon, 31 Jul 2023 15:14:59 +0200 Subject: [PATCH] Path parsing --- app/Main.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 8b8db3f..952d6cd 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -62,12 +62,12 @@ parseArgs (Args t dir h v r c) = do if not (null h) then putStr $ "\n\n" ++ h ++ "\n\n" else putStr "\n" - mapM_ (mkIndex r) . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir + mapM_ (mkIndex r dir) . filter (isSuffixOf ".gmi") =<< getDirectoryContents dir -mkIndex :: Bool -> FilePath -> IO () -mkIndex True l = do - line <- readFile l +mkIndex :: Bool -> FilePath -> FilePath -> IO () +mkIndex True d l = do + line <- readFile $ d++"/"++l putStrLn $ "=> " ++ l ++ " " ++ (head . lines $ line) -mkIndex False l = putStrLn $ "=> " ++ l +mkIndex False _ l = putStrLn $ "=> " ++ l --compose = (++) <$> ("=> " ++) <*> (show . length) <*> (head . lines =<< readFile)