use correct names of IOArray operations for nhc98
[haskell-directory.git] / System / Directory.hs
index 8b7dee3..bdd7f3c 100644 (file)
@@ -79,6 +79,11 @@ import NHC.FFI
 import Hugs.Directory
 #endif /* __HUGS__ */
 
+#if defined(__GLASGOW_HASKELL__) || defined(mingw32_HOST_OS)
+import Foreign
+import Foreign.C
+#endif
+
 #ifdef __GLASGOW_HASKELL__
 import Prelude
 
@@ -87,8 +92,6 @@ import System.Posix.Types
 import System.Posix.Internals
 import System.Time             ( ClockTime(..) )
 import System.IO
-import Foreign
-import Foreign.C
 
 import GHC.IOBase      ( IOException(..), IOErrorType(..), ioException )
 
@@ -576,7 +579,7 @@ canonicalizePath fpath = return fpath
 -- such executable. For example (findExecutable \"ghc\")
 -- gives you the path to GHC.
 findExecutable :: String -> IO (Maybe FilePath)
-findExecutable binary = do
+findExecutable binary =
 #if defined(mingw32_HOST_OS)
   withCString binary $ \c_binary ->
   withCString ('.':exeExtension) $ \c_ext ->
@@ -588,7 +591,7 @@ findExecutable binary = do
               return (Just fpath)
       else return Nothing
 
-foreign import stdcall unsafe "SearchPath"
+foreign import stdcall unsafe "SearchPathA"
             c_SearchPath :: CString
                          -> CString
                          -> CString
@@ -596,7 +599,12 @@ foreign import stdcall unsafe "SearchPath"
                          -> CString
                          -> Ptr CString
                          -> IO CInt
+# if !defined(__GLASGOW_HASKELL__)
+long_path_size :: Int
+long_path_size = 4096
+# endif
 #else
+ do
   path <- getEnv "PATH"
   search (parseSearchPath path)
   where