diff options
| author | aarne <aarne@cs.chalmers.se> | 2006-03-02 09:55:50 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2006-03-02 09:55:50 +0000 |
| commit | 35aac815db52ecdb6fd12e61139d3a74545cac6d (patch) | |
| tree | 72e3863db7f88b29f533cb8c8839d0696a6a6b54 /src/GF/Infra | |
| parent | c30936dc16adf799c94722c54635b914aeca33c6 (diff) | |
tb -trees ; rl ; path in gfe ; removed spurious "file not found"
Diffstat (limited to 'src/GF/Infra')
| -rw-r--r-- | src/GF/Infra/Option.hs | 3 | ||||
| -rw-r--r-- | src/GF/Infra/UseIO.hs | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/GF/Infra/Option.hs b/src/GF/Infra/Option.hs index 81ddd44af..0d0e7ad35 100644 --- a/src/GF/Infra/Option.hs +++ b/src/GF/Infra/Option.hs @@ -256,7 +256,8 @@ showMulti = iOpt "multi" fromSource = iOpt "src" makeConcrete = iOpt "examples" fromExamples = iOpt "ex" -openEditor = iOpt "edit" +openEditor = iOpt "edit" +getTrees = iOpt "trees" -- ** mainly for stand-alone 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 |
