diff --git a/CHANGES.txt b/CHANGES.txt index 15330cf8..17dd3979 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/Action/CmdLine.hs b/src/Action/CmdLine.hs index deccaf52..9543f26d 100644 --- a/src/Action/CmdLine.hs +++ b/src/Action/CmdLine.hs @@ -8,6 +8,7 @@ module Action.CmdLine( whenLoud, whenNormal ) where +import Control.Monad (unless) import Data.List.Extra import Data.Version import General.Util @@ -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) @@ -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"