unbreak previous patch for nhc98
[haskell-directory.git] / System / Directory.hs
index 42ed6af..d1cf495 100644 (file)
@@ -584,7 +584,9 @@ canonicalizePath fpath =
 #else
     do c_realpath pInPath pOutPath
 #endif
-       peekCString pOutPath
+       path <- peekCString pOutPath
+       return (normalise path)
+        -- normalise does more stuff, like upper-casing the drive letter
 
 #if defined(mingw32_HOST_OS)
 foreign import stdcall unsafe "GetFullPathNameA"
@@ -1025,7 +1027,14 @@ getTemporaryDirectory = do
      r <- c_GetTempPath (fromIntegral long_path_size) pPath
      peekCString pPath
 #else
-  catch (getEnv "TMPDIR") (\ex -> return "/tmp")
+  getEnv "TMPDIR"
+#if !__NHC__
+    `catch` \ex -> case ex of
+                     IOException e | isDoesNotExistError e -> return "/tmp"
+                     _ -> throw ex
+#else
+    `catch` (\ex -> return "/tmp")
+#endif
 #endif
 
 #if defined(mingw32_HOST_OS)