Commit 36265a1a authored by simonmar's avatar simonmar
Browse files

[project @ 2003-07-18 12:55:06 by simonmar]

oops, remove excess baggage in previous commit
parent 37ad132b
......@@ -65,6 +65,7 @@ module SysTools (
#include "HsVersions.h"
import DriverUtil
import DriverPhases ( haskellish_user_src_file )
import Config
import Outputable
import Panic ( progName, GhcException(..) )
......@@ -650,10 +651,8 @@ setTmpDir dir = writeIORef v_TmpDir (canonicalise dir)
#endif
cleanTempFiles :: Int -> IO ()
cleanTempFiles verb
= do fs <- readIORef v_FilesToClean
removeTmpFiles verb fs
writeIORef v_FilesToClean []
cleanTempFiles verb = do fs <- readIORef v_FilesToClean
removeTmpFiles verb fs
cleanTempFilesExcept :: Int -> [FilePath] -> IO ()
cleanTempFilesExcept verb dont_delete
......@@ -683,10 +682,25 @@ addFilesToClean files = mapM_ (add v_FilesToClean) files
removeTmpFiles :: Int -> [FilePath] -> IO ()
removeTmpFiles verb fs
= traceCmd "Deleting temp files"
("Deleting: " ++ unwords fs)
(mapM_ rm fs)
= warnNon $
traceCmd "Deleting temp files"
("Deleting: " ++ unwords deletees)
(mapM_ rm deletees)
where
-- Flat out refuse to delete files that are likely to be source input
-- files (is there a worse bug than having a compiler delete your source
-- files?)
--
-- Deleting source files is a sign of a bug elsewhere, so prominently flag
-- the condition.
warnNon act
| null non_deletees = act
| otherwise = do
hPutStrLn stderr ("WARNING - NOT deleting source files: " ++ unwords non_deletees)
act
(non_deletees, deletees) = partition haskellish_user_src_file fs
rm f = removeFile f `IO.catch`
(\_ignored ->
when (verb >= 2) $
......@@ -819,12 +833,8 @@ interpreted a command line 'foo\baz' as 'foobaz'.
-----------------------------------------------------------------------------
-- Convert filepath into platform / MSDOS form.
-- platformPath does two things
-- a) change '/' to '\'
-- b) remove initial '/cygdrive/'
normalisePath :: String -> String
-- Just change '\' to '/'
-- Just changes '\' to '/'
pgmPath :: String -- Directory string in Unix format
-> String -- Program name with no directory separators
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment