[project @ 2001-08-08 13:21:04 by qrczak]
[ghc-hetmet.git] / ghc / lib / std / Directory.hsc
index d04d3db..1ce5844 100644 (file)
@@ -1,5 +1,5 @@
 -- -----------------------------------------------------------------------------
--- $Id: Directory.hsc,v 1.8 2001/03/01 12:25:33 rrt Exp $
+-- $Id: Directory.hsc,v 1.13 2001/07/13 11:48:52 rrt Exp $
 --
 -- (c) The University of Glasgow, 1994-2000
 --
@@ -54,19 +54,18 @@ import Prelude              -- Just to get it in the dependencies
 
 import Time             ( ClockTime(..) )
 
+import PrelPosix
 import PrelStorable
 import PrelCString
 import PrelMarshalAlloc
 import PrelCTypesISO
 import PrelCTypes
-import PrelPosixTypes
 import PrelCError
 import PrelPtr
 import PrelIOBase
 import PrelBase
 
--- Fix mingw stat problem
-#include "../includes/Stg.h"
+#include "config.h"
 #include <sys/stat.h>
 #include <dirent.h>
 #include <limits.h>
@@ -500,40 +499,24 @@ setPermissions name (Permissions r w e s) = do
 
 withFileStatus :: FilePath -> (Ptr CStat -> IO a) -> IO a
 withFileStatus name f = do
-#ifndef mingw32_TARGET_OS
     allocaBytes (#const sizeof(struct stat)) $ \p ->
-#else
-    allocaBytes (#const sizeof(struct _stati64)) $ \p ->
-#endif
       withUnsafeCString name $ \s -> do
         throwErrnoIfMinus1Retry_ "withFileStatus" (stat s p)
        f p
 
 modificationTime :: Ptr CStat -> IO ClockTime
 modificationTime stat = do
-#ifndef mingw32_TARGET_OS
     mtime <- (#peek struct stat, st_mtime) stat
-#else
-    mtime <- (#peek struct _stati64, st_mtime) stat
-#endif
     return (TOD (toInteger (mtime :: CTime)) 0)
 
 isDirectory :: Ptr CStat -> IO Bool
 isDirectory stat = do
-#ifndef mingw32_TARGET_OS
   mode <- (#peek struct stat, st_mode) stat
-#else
-  mode <- (#peek struct _stati64, st_mode) stat
-#endif
   return (s_ISDIR mode /= 0)
 
 isRegularFile :: Ptr CStat -> IO Bool
 isRegularFile stat = do
-#ifndef mingw32_TARGET_OS
   mode <- (#peek struct stat, st_mode) stat
-#else
-  mode <- (#peek struct _stati64, st_mode) stat
-#endif
   return (s_ISREG mode /= 0)
 
 foreign import ccall unsafe s_ISDIR :: CMode -> Int
@@ -571,4 +554,3 @@ foreign import ccall unsafe closedir :: Ptr CDir -> IO CInt
 foreign import ccall unsafe stat     :: UCString -> Ptr CStat -> IO CInt
 
 type CDirent = ()
-type CStat   = ()