From c28de19faabd0d8f90c2f676e424133b4375f1d5 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 18 Mar 2023 22:04:37 +0800 Subject: [PATCH] Fix GC with XDG dirs, fixes #810 --- lib/GHCup/Utils/Dirs.hs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/GHCup/Utils/Dirs.hs b/lib/GHCup/Utils/Dirs.hs index 8c55422..a31d442 100644 --- a/lib/GHCup/Utils/Dirs.hs +++ b/lib/GHCup/Utils/Dirs.hs @@ -279,7 +279,7 @@ ghcupCacheDir Nothing -> do home <- liftIO getHomeDirectory pure (home ".cache") - pure (GHCupPath (bdir "ghcup")) + pure (GHCupPath (bdir "ghcup" "cache")) else ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "cache")) @@ -308,19 +308,7 @@ ghcupLogsDir -- If 'GHCUP_USE_XDG_DIRS' is set (to anything), -- then uses 'XDG_CACHE_HOME/ghcup/db as per xdg spec. ghcupDbDir :: IO GHCupPath -ghcupDbDir - | isWindows = ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "db")) - | otherwise = do - xdg <- useXDG - if xdg - then do - bdir <- lookupEnv "XDG_CACHE_HOME" >>= \case - Just r -> pure r - Nothing -> do - home <- liftIO getHomeDirectory - pure (home ".cache") - pure (GHCupPath (bdir "ghcup" "db")) - else ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "db")) +ghcupDbDir = ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "db")) -- | '~/.ghcup/trash'.