Skip to content
Snippets Groups Projects
Commit 71edb7d2 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Merge pull request #2680 from BardurArantsson/sandbox-config-does-not-exist

Exit with an error if $CABAL_SANDBOX_CONFIG does not point to extant file
parents 94369a18 3488f593
No related branches found
No related tags found
No related merge requests found
......@@ -108,6 +108,7 @@ import Control.Exception ( assert, bracket_ )
import Control.Monad ( forM, liftM2, unless, when )
import Data.Bits ( shiftL, shiftR, xor )
import Data.Char ( ord )
import Data.Foldable ( forM_ )
import Data.IORef ( newIORef, writeIORef, readIORef )
import Data.List ( delete, foldl' )
import Data.Maybe ( fromJust )
......@@ -176,7 +177,11 @@ updateSandboxConfigFileFlag globalFlags =
case globalSandboxConfigFile globalFlags of
Flag _ -> return globalFlags
NoFlag -> do
f' <- fmap (maybe NoFlag Flag) . lookupEnv $ "CABAL_SANDBOX_CONFIG"
fp <- lookupEnv "CABAL_SANDBOX_CONFIG"
forM_ fp $ \fp' -> do -- Check for existence if environment variable set
exists <- doesFileExist fp'
unless exists $ die $ "Cabal sandbox file in $CABAL_SANDBOX_CONFIG does not exist: " ++ fp'
let f' = maybe NoFlag Flag fp
return globalFlags { globalSandboxConfigFile = f' }
-- | Return the path to the sandbox config file - either the default or the one
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment