From dd4849133efcd7e9a961cab38932d9f65a21d9f4 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Fri, 3 Apr 2026 16:41:22 +0900 Subject: [PATCH 1/2] fix: modify message to indicate log file location when following XDG style --- lib-tui/GHCup/Brick/Actions.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-tui/GHCup/Brick/Actions.hs b/lib-tui/GHCup/Brick/Actions.hs index cdf6b7b59..f5654e402 100644 --- a/lib-tui/GHCup/Brick/Actions.hs +++ b/lib-tui/GHCup/Brick/Actions.hs @@ -308,7 +308,7 @@ installWithOptions opts (_, ListResult {..}) = do VLeft (V (AlreadyInstalled _ _)) -> pure $ Right () VLeft (V NoUpdate) -> pure $ Right () VLeft e -> pure $ Left $ prettyHFError e <> "\n" - <> "Also check the logs in ~/.ghcup/logs" + <> "Also check the logs in ~/.ghcup/logs or $XDG_CACHE_HOME/ghcup/logs" install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m) => (Int, ListResult) -> m (Either String ()) From db260a076bed626a01b13fde4e2ba77261de34a9 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Fri, 3 Apr 2026 16:37:19 +0900 Subject: [PATCH 2/2] refactor!: store log files under XDG_STATE_HOME instead of XDG_CACHE_HOME when following XDG style https://specifications.freedesktop.org/basedir/0.8/#variables --- lib-tui/GHCup/Brick/Actions.hs | 2 +- lib/GHCup/Query/GHCupDirs.hs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib-tui/GHCup/Brick/Actions.hs b/lib-tui/GHCup/Brick/Actions.hs index f5654e402..e61727301 100644 --- a/lib-tui/GHCup/Brick/Actions.hs +++ b/lib-tui/GHCup/Brick/Actions.hs @@ -308,7 +308,7 @@ installWithOptions opts (_, ListResult {..}) = do VLeft (V (AlreadyInstalled _ _)) -> pure $ Right () VLeft (V NoUpdate) -> pure $ Right () VLeft e -> pure $ Left $ prettyHFError e <> "\n" - <> "Also check the logs in ~/.ghcup/logs or $XDG_CACHE_HOME/ghcup/logs" + <> "Also check the logs in ~/.ghcup/logs or $XDG_STATE_HOME/ghcup/logs" install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, MonadMask m, MonadUnliftIO m, Alternative m) => (Int, ListResult) -> m (Either String ()) diff --git a/lib/GHCup/Query/GHCupDirs.hs b/lib/GHCup/Query/GHCupDirs.hs index 146e68511..6785f8f22 100644 --- a/lib/GHCup/Query/GHCupDirs.hs +++ b/lib/GHCup/Query/GHCupDirs.hs @@ -232,7 +232,7 @@ ghcupCacheDir -- | Defaults to '~/.ghcup/logs'. -- -- If 'GHCUP_USE_XDG_DIRS' is set (to anything), --- then uses 'XDG_CACHE_HOME/ghcup/logs' as per xdg spec. +-- then uses 'XDG_STATE_HOME/ghcup/logs' as per xdg spec. ghcupLogsDir :: IO GHCupPath ghcupLogsDir | isWindows = ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "logs")) @@ -240,11 +240,11 @@ ghcupLogsDir xdg <- useXDG if xdg then do - bdir <- lookupEnv "XDG_CACHE_HOME" >>= \case + bdir <- lookupEnv "XDG_STATE_HOME" >>= \case Just r -> pure r Nothing -> do home <- liftIO getHomeDirectory - pure (home ".cache") + pure (home ".local" "state") pure (GHCupPath (bdir "ghcup" "logs")) else ghcupBaseDir <&> (\(GHCupPath gp) -> GHCupPath (gp "logs"))