1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Description: Use Debian's hoogle database
Allow hoogle to fall back to the Debian's global database
if the default doesn't exist.
Author: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
Forwarded: no, Debian specific
Index: b/src/Action/CmdLine.hs
===================================================================
--- a/src/Action/CmdLine.hs
+++ b/src/Action/CmdLine.hs
@@ -71,9 +71,17 @@ getCmdLine args = do
args <- withArgs args $ cmdArgsRun cmdLineMode
-- fill in the default database
+ -- If a database has not been given, and the default does not exist,
+ -- and this is not a generate command, fallback to the Debian database.
args <- if database args /= "" then return args else do
dir <- getAppUserDataDirectory "hoogle"
- return $ args{database=dir </> "default-" ++ lower (show $ language args) ++ "-" ++ showVersion version ++ ".hoo"}
+ let db = dir </> "default-" ++ lower (show $ language args) ++ "- " ++ showVersion version ++ ".hoo"
+ debdb = "/var/lib/hoogle/databases/default.hoo"
+ db_exists <- doesFileExist db
+ case args of
+ Generate{..} -> return $ args{database=db}
+ _ | db_exists -> return $ args{database=db}
+ _ -> return $ args{database=debdb}
-- fix up people using Hoogle 4 instructions
args <- case args of
|