From: ross Date: Sat, 18 Dec 2004 00:45:27 +0000 (+0000) Subject: [project @ 2004-12-18 00:45:27 by ross] X-Git-Tag: nhc98-1-18-release~154 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2b7edca7f9f50651237f4a0f246cb986ddcabc27;p=ghc-base.git [project @ 2004-12-18 00:45:27 by ross] Add system-dependent filename extensions: exeExtension ("" or ".exe") objExtension (".o" or ".obj") dllExtension (".so" or ".dll") --- diff --git a/System/Directory.hs b/System/Directory.hs index d3133d4..b35525c 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -523,7 +523,7 @@ findExecutable binary = do path <- getEnv "PATH" search (parseSearchPath path) where - fileName = binary `joinFileExt` drop 1 exeExt + fileName = binary `joinFileExt` drop 1 exeExtension search :: [FilePath] -> IO (Maybe FilePath) search [] = return Nothing @@ -533,14 +533,6 @@ findExecutable binary = do if b then return (Just path) else search ds --- ToDo: This should be determined via autoconf (AC_EXEEXT) -exeExt :: String -#ifdef mingw32_TARGET_OS -exeExt = ".exe" -#else -exeExt = "" -#endif - #ifdef __GLASGOW_HASKELL__ {- |@'getDirectoryContents' dir@ returns a list of /all/ entries in /dir/. diff --git a/System/FilePath.hs b/System/FilePath.hs index b27dd4f..dba6b0f 100644 --- a/System/FilePath.hs +++ b/System/FilePath.hs @@ -36,6 +36,11 @@ module System.FilePath , isPathSeparator , pathSeparator , searchPathSeparator + + -- * Filename extensions + , exeExtension + , objExtension + , dllExtension ) where import Prelude -- necessary to get dependencies right @@ -378,3 +383,27 @@ searchPathSeparator = ';' #else searchPathSeparator = ':' #endif + +-- ToDo: This should be determined via autoconf (AC_EXEEXT) +-- | Extension for executable files +-- (typically @""@ on Unix and @".exe"@ on Windows or OS/2) +exeExtension :: String + +-- ToDo: This should be determined via autoconf (AC_OBJEXT) +-- | Extension for object files +-- (typically @".o"@ on Unix and @".obj"@ on Windows) +objExtension :: String + +-- | Extension for dynamically linked (or shared) libraries +-- (typically @".so"@ on Unix and @".dll"@ on Windows) +dllExtension :: String + +#ifdef mingw32_TARGET_OS +exeExtension = ".exe" +objExtension = ".obj" +dllExtension = ".dll" +#else +exeExtension = "" +objExtension = ".o" +dllExtension = ".so" +#endif