summaryrefslogtreecommitdiff
path: root/ghc/compiler/main
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/compiler/main')
-rw-r--r--ghc/compiler/main/Packages.lhs11
1 files changed, 7 insertions, 4 deletions
diff --git a/ghc/compiler/main/Packages.lhs b/ghc/compiler/main/Packages.lhs
index ac26a9ab6f..06180a172b 100644
--- a/ghc/compiler/main/Packages.lhs
+++ b/ghc/compiler/main/Packages.lhs
@@ -201,12 +201,15 @@ readPackageConfigs dflags = do
-- unless the -no-user-package-conf flag was given.
-- We only do this when getAppUserDataDirectory is available
-- (GHC >= 6.3).
- appdir <- getAppUserDataDirectory "ghc"
- let
+ (exists, pkgconf) <- catch (do
+ appdir <- getAppUserDataDirectory "ghc"
+ let
pkgconf = appdir ++ '/':TARGET_ARCH ++ '-':TARGET_OS
++ '-':cProjectVersion ++ "/package.conf"
- --
- exists <- doesFileExist pkgconf
+ flg <- doesFileExist pkgconf
+ return (flg, pkgconf))
+ -- gobble them all up and turn into False.
+ (\ _ -> return (False, ""))
pkg_map2 <- if (dopt Opt_ReadUserPackageConf dflags && exists)
then readPackageConfig dflags pkg_map1 pkgconf
else return pkg_map1