From a4063a159aba3b14bcc2441a504692de279f2df9 Mon Sep 17 00:00:00 2001 From: malcolm Date: Sun, 14 Nov 2004 10:47:26 +0000 Subject: [PATCH] [project @ 2004-11-14 10:47:26 by malcolm] Allow new additions to build with nhc98 too. (I suspect more work is still needed to make them portable to Hugs as well.) --- System/Directory.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index 62072a2..20e041f 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -64,6 +64,10 @@ module System.Directory #ifdef __NHC__ import Directory +import System (getEnv) +import System.FilePath +import NHC.FFI +import IO (try) #endif /* __NHC__ */ #ifdef __HUGS__ @@ -441,6 +445,8 @@ renameFile opath npath = withCString npath $ \s2 -> throwErrnoIfMinus1Retry_ "renameFile" (c_rename s1 s2) +#endif /* __GLASGOW_HASKELL__ */ + {- |@'copyFile' old new@ copies the existing file from /old/ to /new/. If the /new/ file already exists, it is atomically replaced by the /old/ file. Neither path may refer to an existing directory. @@ -470,6 +476,7 @@ copyFile fromFPath toFPath = copyContents hFrom hTo buffer #endif +#ifdef __GLASGOW_HASKELL__ -- | Given path referring to a file or directory, returns a -- canonicalized path, with the intent that two paths referring -- to the same file\/directory will map to the same canonicalized @@ -502,6 +509,11 @@ foreign import ccall unsafe "realpath" -> CString -> IO CString #endif +#else /* !__GLASGOW_HASKELL__ */ +-- dummy implementation +canonicalizePath :: FilePath -> IO FilePath +canonicalizePath fpath = return fpath +#endif /* !__GLASGOW_HASKELL__ */ -- | Given an executable file name, searches for such file -- in the directories listed in system PATH. The returned value @@ -527,7 +539,7 @@ findExecutable binary = do if b then return (Just path) else search ds - +#ifdef __GLASGOW_HASKELL__ {- |@'getDirectoryContents' dir@ returns a list of /all/ entries in /dir/. -- 1.7.10.4