Skip to content

Commit

Permalink
Merge pull request #2680 from BardurArantsson/sandbox-config-does-not…
Browse files Browse the repository at this point in the history
…-exist

Exit with an error if $CABAL_SANDBOX_CONFIG does not point to extant file
  • Loading branch information
dcoutts committed Jul 7, 2015
2 parents 94369a1 + 3488f59 commit 71edb7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cabal-install/Distribution/Client/Sandbox.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71edb7d

Please sign in to comment.