From 16ce00f5678337f30a19acd21f212332e4b92bf0 Mon Sep 17 00:00:00 2001
From: Lemmih <lemmih@gmail.com>
Date: Sun, 6 Aug 2006 13:54:23 +0000
Subject: [PATCH] Don't check for packagesDirName and servListFile, they may
 not exist.

---
 Network/Hackage/CabalInstall/Config.hs | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/Network/Hackage/CabalInstall/Config.hs b/Network/Hackage/CabalInstall/Config.hs
index 7d219cbb33..5fa85404d2 100644
--- a/Network/Hackage/CabalInstall/Config.hs
+++ b/Network/Hackage/CabalInstall/Config.hs
@@ -65,10 +65,7 @@ isValidConfigDir :: FilePath -> IO Bool
 isValidConfigDir path
     = do checks <- sequence
                    [ checkFiles readable [ path
-                                         , path `joinFileName` servListFile ]
-                   , checkFiles writable [ path
-                                         , path `joinFileName` pkgListFile
-                                         , path `joinFileName` packagesDirectoryName ]]
+                                         , path `joinFileName` servListFile ]]
          return (and checks)
 
 -- |Picks the first valid config directory or throws an exception if none were found.
@@ -81,11 +78,11 @@ selectValidConfigDir paths
 
 checkFiles :: (Permissions -> Bool) -> [FilePath] -> IO Bool
 checkFiles check
-    = worker
-    where worker [] = return True
-          worker (x:xs)
+    = worker True
+    where worker r [] = return r
+          worker r (x:xs)
               = do permissions <- getPermissions x
                    if check permissions
-                      then worker xs
+                      then worker r xs
                       else return False
-              `mplus` worker xs
+              `mplus` worker False xs
-- 
GitLab