From 2c6e9aa6d42d4c427dc6ab54a72f82fbfc58a1ca Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sun, 22 Jul 2007 10:54:45 +0000 Subject: [PATCH] Tweak temporary file filename chooser --- System/IO.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/System/IO.hs b/System/IO.hs index 0d9d029..2970cf0 100644 --- a/System/IO.hs +++ b/System/IO.hs @@ -425,7 +425,12 @@ openTempFile' loc tmp_dir template binary = do pid <- c_getpid findTempName pid where - (prefix,suffix) = break (=='.') template + -- We split off the last extension, so we can use .foo.ext files + -- for temporary files (hidden on Unix OSes). Unfortunately we're + -- below filepath in the hierarchy here. + (prefix,suffix) = case break (== '.') $ reverse template of + (rev_suffix, rev_prefix) -> + (reverse rev_prefix, reverse rev_suffix) oflags1 = rw_flags .|. o_EXCL -- 1.7.10.4