Changeset 7447 for src/Pugs.hs
- Timestamp:
- 10/08/05 21:00:13 (3 years ago)
- Files:
-
- 1 modified
-
src/Pugs.hs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs.hs
r7405 r7447 232 232 case map toLower backend of 233 233 "js" -> if (args' == []) 234 then (doExecuteHelper [ "perl5", "PIL2JS", "jspugs.pl" ]args)235 else (doExecuteHelper [ "perl5", "PIL2JS", "runjs.pl" ]args)236 "perl5" -> doExecuteHelper [ "perl5", "PIL-Run", "pugs-p5.pl" ]args234 then (doExecuteHelper "jspugs.pl" args) 235 else (doExecuteHelper "runjs.pl" args) 236 "perl5" -> doExecuteHelper "pugs-p5.pl" args 237 237 _ -> fail ("unknown backend: " ++ backend) 238 238 where … … 244 244 f (x:xs) = x:f xs 245 245 246 doExecuteHelper :: [FilePath]-> [String] -> IO ()246 doExecuteHelper :: FilePath -> [String] -> IO () 247 247 doExecuteHelper helper args = do 248 let searchPaths = [["."], ["..", ".."], [getConfig "installsitelib"], [getConfig "sourcedir"]]248 let searchPaths = concatMap (\x -> map (x++) suffixes) [["."], ["..", ".."], [getConfig "sourcedir"], [getConfig "pugslibdir"]] 249 249 mbin <- findHelper searchPaths 250 250 case mbin of 251 251 Just binary -> do 252 252 exitWith =<< executeFile' perl5 True (binary:args) Nothing 253 _ -> fail ("Couldn't find helper program " ++ (foldl1 joinFileName helper) ++ " (searched in " ++ show searchPaths ++ ")") 254 where 253 _ -> fail ("Couldn't find helper program " ++ helper ++ " (searched in " ++ show (map (foldl1 joinFileName) searchPaths) ++ ")") 254 where 255 suffixes = 256 [ [] 257 , ["perl5", "PIL2JS"] -- $sourcedir/perl5/PIL2JS/jspugs.pl 258 , ["perl5", "PIL-Run"] -- $sourcedir/perl5/PIL-Run/pugs-p5.pl 259 , ["perl5", "lib"] -- $pugslibdir/perl5/lib/jspugs.pl 260 , ["perl5", "lib", "PIL"] -- $pugslibdir/perl5/PIL/pugs-p5.pl 261 ] 255 262 perl5 = getConfig "perl5path" 256 263 findHelper :: [[FilePath]] -> IO (Maybe FilePath) … … 270 277 | filex' -> return $ Just $ file' x 271 278 | otherwise -> findHelper xs 272 file x = foldl1 joinFileName (x ++ helper)279 file x = foldl1 joinFileName (x ++ [helper]) 273 280 file' x = (file x) ++ (getConfig "exe_ext") 274 281 fileExists path = do
