Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/5fb9cd39be5f86619634faafe64d4f1d11045841

>---------------------------------------------------------------

commit 5fb9cd39be5f86619634faafe64d4f1d11045841
Author: Duncan Coutts <[email protected]>
Date:   Fri Oct 12 11:20:52 2007 +0000

    Don't report errors on cleaning when it's already clean
    We now ignore file not found errors when deleting the packages dir.
    Otherwise when we clean and then clean again we get an exception since
    the directory we're trying to delete has already been deleted.

>---------------------------------------------------------------

 cabal-install/Hackage/Clean.hs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cabal-install/Hackage/Clean.hs b/cabal-install/Hackage/Clean.hs
index 4ccda99..58e3621 100644
--- a/cabal-install/Hackage/Clean.hs
+++ b/cabal-install/Hackage/Clean.hs
@@ -15,11 +15,15 @@ module Hackage.Clean
     ) where
 
 import Hackage.Types (ConfigFlags(..))
+import Hackage.Utils (fileNotFoundExceptions)
 
 import System.Directory (removeDirectoryRecursive)
+import Control.Exception (catchJust)
 
 -- | 'clean' removes all downloaded packages from the {config-dir}\/packages\/ 
directory.
 clean :: ConfigFlags -> IO ()
 clean cfg
-    = removeDirectoryRecursive (configCacheDir cfg)
-
+    = catchJust fileNotFoundExceptions
+        (removeDirectoryRecursive (configCacheDir cfg))
+       -- The packages dir may not exist if it's already cleaned:
+       (const (return ()))



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to