From 76a4e76e8c8e61f63316cb2fd2a0afb0ed57c587 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 18 Oct 2007 12:23:45 +0000 Subject: [PATCH] FIX #1652: openTempFile should accept an empty string for the directory --- System/IO.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/System/IO.hs b/System/IO.hs index 29996d4..64ee0be 100644 --- a/System/IO.hs +++ b/System/IO.hs @@ -478,7 +478,15 @@ openTempFile' loc tmp_dir template binary = do return (filepath, h) where filename = prefix ++ show x ++ suffix - filepath = tmp_dir ++ [pathSeparator] ++ filename + filepath = tmp_dir `combine` filename + + -- XXX bits copied from System.FilePath, since that's not available here + combine a b + | null b = a + | null a = b + | last a == pathSeparator = a ++ b + | otherwise = a ++ [pathSeparator] ++ b + #if __HUGS__ fdToHandle fd = openFd (fromIntegral fd) False ReadWriteMode binary #endif -- 1.7.10.4