Changeset 8392 for src/Pugs/Embed

Show
Ignore:
Timestamp:
12/23/05 13:09:56 (3 years ago)
Author:
audreyt
Message:

* %ENV{PARROT_PATH} is now consulted in runtime for

external parrot invocations (eg. PGE).
(Set it to a directory containing the "parrot" executable.)
Requested by luqui++

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Embed/Parrot.hsc

    r7852 r8392  
    2020    if isJust rv then return rv else do 
    2121    cwd <- getCurrentDirectory 
     22    rv  <- findExecutableInDirectory cwd cmd 
     23    if isJust rv then return rv else do 
     24    dir <- getEnv "PARROT_PATH" 
     25    if isNothing dir then return Nothing else do 
     26    rv  <- findExecutableInDirectory (fromJust dir) cmd 
     27    if isJust rv then return rv else do 
     28    return Nothing 
     29 
     30findExecutableInDirectory dir cmd = do 
    2231##ifdef PUGS_HAVE_POSIX 
    23     let parrot = cwd ++ ('/':cmd) 
     32    let file = dir ++ ('/':cmd) 
    2433##else 
    25     let parrot = cwd ++ ('\\':cmd) ++ ".exe" 
     34    let file = dir ++ ('\\':cmd) ++ ".exe" 
    2635##endif 
    27     ok  <- doesFileExist parrot 
    28     return $ if ok then Just parrot else Nothing 
     36    print ("Exisitng", file) 
     37    ok  <- doesFileExist file 
     38    return $ if ok then Just file else Nothing 
    2939 
    3040findParrot :: IO FilePath