From 35aac815db52ecdb6fd12e61139d3a74545cac6d Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 2 Mar 2006 09:55:50 +0000 Subject: tb -trees ; rl ; path in gfe ; removed spurious "file not found" --- src/GF/Infra/UseIO.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/GF/Infra/UseIO.hs') diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs index 7bf9edaf1..76563b5ad 100644 --- a/src/GF/Infra/UseIO.hs +++ b/src/GF/Infra/UseIO.hs @@ -88,8 +88,11 @@ isSep :: Char -> Bool isSep c = c == '/' || c == '\\' getFilePath :: [FilePath] -> String -> IO (Maybe FilePath) -getFilePath paths file = get paths where - get [] = putStrLnFlush ("file" +++ file +++ "not found") >> return Nothing +getFilePath ps file = getFilePathMsg ("file" +++ file +++ "not found\n") ps file + +getFilePathMsg :: String -> [FilePath] -> String -> IO (Maybe FilePath) +getFilePathMsg msg paths file = get paths where + get [] = putStrFlush msg >> return Nothing get (p:ps) = let pfile = prefixPathName p file in catch (readFile pfile >> return (Just pfile)) (\_ -> get ps) @@ -104,7 +107,7 @@ readFileIfPath paths file = do doesFileExistPath :: [FilePath] -> String -> IOE Bool doesFileExistPath paths file = do - mpfile <- ioeIO $ getFilePath paths file + mpfile <- ioeIO $ getFilePathMsg "" paths file return $ maybe False (const True) mpfile -- | first var is lib prefix, second is like class path -- cgit v1.2.3