Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hoogle will now use the `$XDG_DATA_DIR` instead of `~/.hoogle` as
default path but steal keep use the old one as a fall back.
  • Loading branch information
jokesper committed Jul 28, 2023
1 parent 2f2d101 commit 25999e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Action/CmdLine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ data CmdLine

defaultDatabaseLang :: Language -> IO FilePath
defaultDatabaseLang lang = do
dir <- getAppUserDataDirectory "hoogle"
pure $ dir </> "default-" ++ lower (show lang) ++ "-" ++ showVersion (trimVersion 3 version) ++ ".hoo"
xdgLocation <- getXdgDirectory XdgData "hoogle"
legacyLocation <- getAppUserDataDirectory "hoogle"
canIgnoreLegacyPath <- doesPathExist xdgLocation
pure $
(if canIgnoreLegacyPath then xdgLocation else legacyLocation) </>
"default-" ++ lower (show lang) ++ "-" ++ showVersion (trimVersion 3 version) ++ ".hoo"

getCmdLine :: [String] -> IO CmdLine
getCmdLine args = do
Expand Down

0 comments on commit 25999e4

Please sign in to comment.