[project @ 2004-12-18 00:45:27 by ross]
[haskell-directory.git] / System / FilePath.hs
index 317c7f4..dba6b0f 100644 (file)
@@ -36,8 +36,15 @@ module System.FilePath
          , isPathSeparator
          , pathSeparator
          , searchPathSeparator
+
+        -- * Filename extensions
+        , exeExtension
+        , objExtension
+        , dllExtension
          ) where
 
+import Prelude -- necessary to get dependencies right
+
 import Data.List(intersperse)
 
 --------------------------------------------------------------
@@ -288,9 +295,11 @@ commonParent paths@(p:ps) =
 #endif
     mb_path   -> mb_path
   where
+#ifdef mingw32_TARGET_OS
     getDrive (d:':':_) ds 
       | not (d `elem` ds) = d:ds
     getDrive _         ds = ds
+#endif
 
     common i acc []     ps = checkSep   i acc         ps
     common i acc (c:cs) ps
@@ -374,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