Commit c1cc5200 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

sandbox init: warn instead of dying if there's a cabal-dev sandbox.

Fixes #1472.
parent 03d12e64
...@@ -275,14 +275,14 @@ dumpPackageEnvironment verbosity _sandboxFlags globalFlags = do ...@@ -275,14 +275,14 @@ dumpPackageEnvironment verbosity _sandboxFlags globalFlags = do
-- | Entry point for the 'cabal sandbox-init' command. -- | Entry point for the 'cabal sandbox-init' command.
sandboxInit :: Verbosity -> SandboxFlags -> GlobalFlags -> IO () sandboxInit :: Verbosity -> SandboxFlags -> GlobalFlags -> IO ()
sandboxInit verbosity sandboxFlags globalFlags = do sandboxInit verbosity sandboxFlags globalFlags = do
-- Check that there is no 'cabal-dev' directory. -- Warn if there's a 'cabal-dev' sandbox.
isCabalDevSandbox <- liftM2 (&&) (doesDirectoryExist "cabal-dev") isCabalDevSandbox <- liftM2 (&&) (doesDirectoryExist "cabal-dev")
(doesFileExist $ "cabal-dev" </> "cabal.config") (doesFileExist $ "cabal-dev" </> "cabal.config")
when isCabalDevSandbox $ when isCabalDevSandbox $
die $ warn verbosity $
"You are apparently using a legacy (cabal-dev) sandbox. " "You are apparently using a legacy (cabal-dev) sandbox. "
++ "To use native cabal sandboxing, please delete the 'cabal-dev' directory " ++ "Legacy sandboxes may interact badly with native Cabal sandboxes. "
++ "and run 'cabal sandbox init'." ++ "You may want to delete the 'cabal-dev' directory to prevent issues."
-- Create the sandbox directory. -- Create the sandbox directory.
let sandboxDir' = fromFlagOrDefault defaultSandboxLocation let sandboxDir' = fromFlagOrDefault defaultSandboxLocation
......
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