From: Ian Lynagh Date: Sun, 22 Jul 2007 10:54:45 +0000 (+0000) Subject: Tweak temporary file filename chooser X-Git-Tag: 2007-09-13~41 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=2c6e9aa6d42d4c427dc6ab54a72f82fbfc58a1ca;p=ghc-base.git Tweak temporary file filename chooser --- 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