Fix ghc-pkg inplace on Windows
authorIan Lynagh <igloo@earth.li>
Sat, 19 Jul 2008 00:26:13 +0000 (00:26 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 19 Jul 2008 00:26:13 +0000 (00:26 +0000)
utils/ghc-pkg/Main.hs

index 7f727d7..bb80e63 100644 (file)
@@ -375,7 +375,16 @@ getPkgDatabases modify my_flags = do
         [] -> do mb_dir <- getExecDir "/bin/ghc-pkg.exe"
                  case mb_dir of
                         Nothing  -> die err_msg
-                        Just dir -> return (dir </> "package.conf")
+                        Just dir ->
+                            do let path1 = dir </> "package.conf"
+                                   path2 = dir </> ".." </> ".." </> ".."
+                                               </> "inplace-datadir"
+                                               </> "package.conf"
+                               exists1 <- doesFileExist path1
+                               exists2 <- doesFileExist path2
+                               if exists1 then return path1
+                                   else if exists2 then return path2
+                                   else die "Can't find package.conf"
         fs -> return (last fs)
 
   let global_conf_dir = global_conf ++ ".d"