Changeset 7230 for src/Main.hs

Show
Ignore:
Timestamp:
10/03/05 10:59:19 (3 years ago)
Author:
iblech
Message:

* Usual svn props.
* System.FilePath?: Added a not (null fname) guard (i.e., fixed a bug).

We should probably propagate the fix upstream (at least when ok'd by a real
lamda hacker).

* Main: Added %?CONFIG<sourcedir> to the list of paths to search and

added a tryIO call so the search doesn't die.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Main.hs

    r7162 r7230  
    235235doExecuteHelper :: [FilePath] -> [String] -> IO () 
    236236doExecuteHelper helper args = do 
    237     mbin <- findHelper [["."], ["..", ".."]] 
     237    let searchPaths = [["."], ["..", ".."], [getConfig "sourcedir"]] 
     238    mbin <- findHelper searchPaths 
    238239    case mbin of 
    239240        Just binary -> do 
    240241            exitWith =<< executeFile' perl5 True (binary:args) Nothing 
    241         _ -> fail ("Couldn't find helper program" ++ (foldl1 joinFileName helper)) 
     242        _ -> fail ("Couldn't find helper program " ++ (foldl1 joinFileName helper) ++ " (searched in " ++ show searchPaths ++ ")") 
    242243    where 
    243244    perl5 = getConfig "perl5path" 
     
    262263    fileExists path = do 
    263264        let (p,f) = splitFileName path 
    264         dir <- getDirectoryContents p 
    265         return $ f `elem` dir 
     265        dir <- tryIO Nothing $ fmap Just $ getDirectoryContents p 
     266        case dir of 
     267            Just dir' -> return $ f `elem` dir' 
     268            _         -> return False 
    266269 
    267270doParseWith :: (Env -> FilePath -> IO a) -> FilePath -> String -> IO a