From d451d5f8f8be24d8e16459c85ebf53c152761610 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Apr 2016 11:35:59 -0400 Subject: slightly more robust cabal file reading --- src/Propellor/DotDir.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Propellor/DotDir.hs b/src/Propellor/DotDir.hs index 100342e8..669ac303 100644 --- a/src/Propellor/DotDir.hs +++ b/src/Propellor/DotDir.hs @@ -78,9 +78,11 @@ cabalSandboxRequired :: IO Bool cabalSandboxRequired = ifM cabal ( do home <- myHomeDir - ls <- lines <$> readFile (home ".cabal" "config") + ls <- lines <$> catchDefaultIO [] + (readFile (home ".cabal" "config")) -- For simplicity, we assume a sane ~/.cabal/config here: - return $ "require-sandbox: True" `elem` ls + return $ any ("True" `isInfixOf`) $ + filter ("require-sandbox:" `isPrefixOf`) ls , return False ) where -- cgit v1.3-2-g0d8e