Skip to content

Commit

Permalink
Exit with an error if $CABAL_SANDBOX_CONFIG does not point to extant …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
BardurArantsson committed Jul 2, 2015
1 parent 03530bf commit 3488f59
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 @@ -102,6 +102,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 @@ -170,7 +171,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 3488f59

Please sign in to comment.