Changeset 16498

Show
Ignore:
Timestamp:
05/22/07 12:40:04 (18 months ago)
Author:
audreyt
Message:

* Pugs.Compat, Pugs.Embed.Parrot: Change the PUGS_HAVE_POSIX

check in .hsc from reading #include <../pugs_config.h> into
using a _PUGS_HAVE_POSIX variable, because relative paths
under .hsc is not reliable (in GHC-HEAD's Cabal, .hsc files
generates dist/build/Pugs/Embed/Parrot.hs rather than the
assumed src/Pugs/Embed/Parrot.hs).

Location:
src/Pugs
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Compat.hs

    r15464 r16498  
    1616 
    1717module Pugs.Compat ( 
     18    _PUGS_HAVE_POSIX, 
    1819    createLink, 
    1920    createSymbolicLink, 
     
    7273import qualified System.Posix.Signals 
    7374 
     75_PUGS_HAVE_POSIX :: Bool 
     76_PUGS_HAVE_POSIX = True 
     77 
    7478doesExist :: FilePath -> IO Bool 
    7579doesExist = fileExist 
     
    142146import System.Posix.Internals 
    143147import Foreign.C.Error 
     148 
     149_PUGS_HAVE_POSIX :: Bool 
     150_PUGS_HAVE_POSIX = False 
    144151 
    145152failWith :: (Monad m) => String -> m a 
  • src/Pugs/Embed/Parrot.hsc

    r13724 r16498  
    11{-# OPTIONS_GHC -fglasgow-exts -cpp -fvia-C -fno-full-laziness -fno-cse #-} 
    22#if !defined(PUGS_HAVE_PARROT) 
    3 ##undef PUGS_HAVE_POSIX 
    4 ##include "../pugs_config.h" 
    53 
    64module Pugs.Embed.Parrot where 
     
    1311import Data.Maybe 
    1412import Control.Monad 
    15 import Pugs.Compat (getEnv) 
     13import Pugs.Compat (getEnv, _PUGS_HAVE_POSIX) 
    1614import Pugs.Internals (encodeUTF8) 
    1715 
     
    3432findExecutableInDirectory :: FilePath -> FilePath -> IO (Maybe FilePath) 
    3533findExecutableInDirectory dir cmd = do 
    36 ##ifdef PUGS_HAVE_POSIX 
    37     let file = dir ++ ('/':cmd) 
    38 ##else 
    39     let file = dir ++ ('\\':cmd) ++ ".exe" 
    40 ##endif 
    41     ok  <- doesFileExist file 
    42     return $ if ok then Just file else Nothing 
     34    let file | _PUGS_HAVE_POSIX = dir ++ ('/':cmd) 
     35             | otherwise        = dir ++ ('\\':cmd) ++ ".exe" 
     36    ok <- doesFileExist file 
     37    return $ if ok then (Just file) else Nothing 
    4338 
    4439findParrot :: IO FilePath