From 6a236a2749c8306c64084289f26581d751e5ea13 Mon Sep 17 00:00:00 2001 From: pilfer-pandex <47340789+pilfer-pandex@users.noreply.github.com> Date: Mon, 17 Aug 2020 11:24:17 -0700 Subject: [PATCH] king: use XDG cache directory for default log location --- pkg/hs/urbit-king/lib/Urbit/King/App.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/hs/urbit-king/lib/Urbit/King/App.hs b/pkg/hs/urbit-king/lib/Urbit/King/App.hs index a4354d72ed..e5a1649af2 100644 --- a/pkg/hs/urbit-king/lib/Urbit/King/App.hs +++ b/pkg/hs/urbit-king/lib/Urbit/King/App.hs @@ -26,7 +26,8 @@ import Urbit.King.Config import Urbit.Prelude import System.Directory ( createDirectoryIfMissing - , getAppUserDataDirectory + , getXdgDirectory + , XdgDirectory(XdgCache) ) import System.Posix.Internals (c_getpid) import System.Posix.Types (CPid(..)) @@ -83,7 +84,6 @@ runKingEnvStderr verb lvl inner = do <&> setLogUseTime True <&> setLogUseLoc False <&> setLogMinLevel lvl - withLogFunc logOptions $ \logFunc -> runKingEnv logFunc logFunc inner runKingEnvLogFile :: Bool -> LogLevel -> Maybe FilePath -> RIO KingEnv a -> IO a @@ -102,7 +102,6 @@ runKingEnvLogFile verb lvl fileM inner = do <&> setLogUseTime False <&> setLogUseLoc False <&> setLogMinLevel lvl - withLogFunc stderrLogOptions $ \stderrLogFunc -> withLogFunc logOptions $ \logFunc -> runKingEnv logFunc stderrLogFunc inner @@ -114,7 +113,7 @@ withLogFileHandle f act = defaultLogFile :: IO FilePath defaultLogFile = do - logDir <- getAppUserDataDirectory "urbit" + logDir <- getXdgDirectory XdgCache "urbit" createDirectoryIfMissing True logDir pure (logDir "king.log")