Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Actually implement 'sandbox-delete'.

  • Loading branch information...
commit 8a0839a738e3901bdf86c34078c989149c2dfaec 1 parent 0c8d697
Mikhail Glushenkov 23Skidoo authored

Showing 1 changed file with 14 additions and 3 deletions. Show diff stats Hide diff stats

  1. +14 3 cabal-install/Distribution/Client/Sandbox.hs
17 cabal-install/Distribution/Client/Sandbox.hs
@@ -54,7 +54,8 @@ import Control.Monad ( unless, when )
54 54 import Data.Monoid ( mappend, mempty )
55 55 import System.Directory ( canonicalizePath
56 56 , doesDirectoryExist
57   - , doesFileExist )
  57 + , doesFileExist
  58 + , removeDirectoryRecursive )
58 59 import System.FilePath ( (</>) )
59 60
60 61
@@ -101,8 +102,18 @@ sandboxInit _verbosity _sandboxFlags _globalFlags = do
101 102
102 103 -- | Entry point for the 'cabal sandbox-delete' command.
103 104 sandboxDelete :: Verbosity -> SandboxFlags -> GlobalFlags -> IO ()
104   -sandboxDelete _verbosity _sandboxFlags _globalFlags = do
105   - die "Not implemented."
  105 +sandboxDelete verbosity sandboxFlags _globalFlags =
  106 + if sandboxLoc == defaultSandboxLocation
  107 + then do
  108 + sandboxDir <- getSandboxLocation verbosity sandboxFlags
  109 + notice verbosity $ "deleting..."
  110 + removeDirectoryRecursive sandboxDir
  111 + else
  112 + die $ "Non-default sandbox location used: " ++ sandboxLoc
  113 + ++ "\nPlease delete manually."
  114 + where
  115 + sandboxLoc = fromFlagOrDefault defaultSandboxLocation
  116 + (sandboxLocation sandboxFlags)
106 117
107 118 -- | Entry point for the 'cabal sandbox-add-source' command.
108 119 sandboxAddSource :: Verbosity -> SandboxFlags -> [FilePath] -> IO ()

0 comments on commit 8a0839a

Please sign in to comment.
Something went wrong with that request. Please try again.