Skip to content

Commit

Permalink
Deprecated legacy location
Browse files Browse the repository at this point in the history
  • Loading branch information
jokesper committed Aug 26, 2024
1 parent 35f85f5 commit b429636
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Changelog for Hoogle (* = API change, @ = database format change)

#411, switched to xdg directory and depracted legacy location
Require and support crypton-connection >= 0.4.1
5.0.18.4, released 2024-01-14
Don't test on GHC 9.2 or earlier
Expand Down
3 changes: 3 additions & 0 deletions src/Action/CmdLine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Action.CmdLine(
whenLoud, whenNormal
) where

import Control.Monad (unless)
import Data.List.Extra
import Data.Version
import General.Util
Expand All @@ -16,6 +17,7 @@ import System.Console.CmdArgs
import System.Directory
import System.Environment
import System.FilePath
import System.IO

data Language = Haskell | Frege deriving (Data,Typeable,Show,Eq,Enum,Bounded)

Expand Down Expand Up @@ -83,6 +85,7 @@ defaultDatabaseLang lang = do
xdgLocation <- getXdgDirectory XdgData "hoogle"
legacyLocation <- getAppUserDataDirectory "hoogle"
canIgnoreLegacyPath <- not <$> doesPathExist legacyLocation
unless canIgnoreLegacyPath (hPutStrLn stderr "Warning: ~/.hoogle is deprecated. Consider moving it to $XDG_DATA_HOME/hoogle (commonly ~/.local/share/hoogle)")
let dir = if canIgnoreLegacyPath then xdgLocation else legacyLocation
pure $ dir </> "default-" ++ lower (show lang) ++ "-" ++ showVersion (trimVersion 3 version) ++ ".hoo"

Expand Down

0 comments on commit b429636

Please sign in to comment.