{-# LANGUAGE DataKinds #-}
module System.XDG where
import Data.ByteString.Lazy ( ByteString )
import Path ( fromAbsDir )
import qualified System.XDG.Internal as In
getDataHome :: IO FilePath
getDataHome :: IO FilePath
getDataHome = Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv (Path Abs Dir)
In.getDataHome
getConfigHome :: IO FilePath
getConfigHome :: IO FilePath
getConfigHome = Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv (Path Abs Dir)
In.getConfigHome
getStateHome :: IO FilePath
getStateHome :: IO FilePath
getStateHome = Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv (Path Abs Dir)
In.getStateHome
getCacheHome :: IO FilePath
getCacheHome :: IO FilePath
getCacheHome = Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv (Path Abs Dir)
In.getCacheHome
getRuntimeDir :: IO FilePath
getRuntimeDir :: IO FilePath
getRuntimeDir = Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv (Path Abs Dir)
In.getRuntimeDir
getDataDirs :: IO [FilePath]
getDataDirs :: IO [FilePath]
getDataDirs = forall a b. (a -> b) -> [a] -> [b]
map Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv [Path Abs Dir]
In.getDataDirs
readDataFile :: FilePath -> IO (Maybe ByteString)
readDataFile :: FilePath -> IO (Maybe ByteString)
readDataFile FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall a. XDGReader a a -> XDGReader a (Maybe a)
In.maybeRead forall a b. (a -> b) -> a -> b
$ forall a. FilePath -> '[Env, Error XDGError, ReadFile a] >@> a
In.readDataFile FilePath
file
readData :: Monoid b => (ByteString -> b) -> FilePath -> IO b
readData :: forall b. Monoid b => (ByteString -> b) -> FilePath -> IO b
readData ByteString -> b
parse FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall b a. Monoid b => (a -> b) -> FilePath -> XDGReader a b
In.readData ByteString -> b
parse FilePath
file
getConfigDirs :: IO [FilePath]
getConfigDirs :: IO [FilePath]
getConfigDirs = forall a b. (a -> b) -> [a] -> [b]
map Path Abs Dir -> FilePath
fromAbsDir forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. XDGReader ByteString a -> IO a
In.runXDGIO XDGEnv [Path Abs Dir]
In.getConfigDirs
readConfigFile :: FilePath -> IO (Maybe ByteString)
readConfigFile :: FilePath -> IO (Maybe ByteString)
readConfigFile FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall a. XDGReader a a -> XDGReader a (Maybe a)
In.maybeRead forall a b. (a -> b) -> a -> b
$ forall a. FilePath -> '[Env, Error XDGError, ReadFile a] >@> a
In.readConfigFile FilePath
file
readConfig :: Monoid b => (ByteString -> b) -> FilePath -> IO b
readConfig :: forall b. Monoid b => (ByteString -> b) -> FilePath -> IO b
readConfig ByteString -> b
parse FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall b a. Monoid b => (a -> b) -> FilePath -> XDGReader a b
In.readConfig ByteString -> b
parse FilePath
file
readCacheFile :: FilePath -> IO (Maybe ByteString)
readCacheFile :: FilePath -> IO (Maybe ByteString)
readCacheFile FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall a. XDGReader a a -> XDGReader a (Maybe a)
In.maybeRead forall a b. (a -> b) -> a -> b
$ forall a. FilePath -> '[Env, Error XDGError, ReadFile a] >@> a
In.readCacheFile FilePath
file
readStateFile :: FilePath -> IO (Maybe ByteString)
readStateFile :: FilePath -> IO (Maybe ByteString)
readStateFile FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall a. XDGReader a a -> XDGReader a (Maybe a)
In.maybeRead forall a b. (a -> b) -> a -> b
$ forall a. FilePath -> '[Env, Error XDGError, ReadFile a] >@> a
In.readStateFile FilePath
file
readRuntimeFile :: FilePath -> IO (Maybe ByteString)
readRuntimeFile :: FilePath -> IO (Maybe ByteString)
readRuntimeFile FilePath
file = forall a. XDGReader ByteString a -> IO a
In.runXDGIO forall a b. (a -> b) -> a -> b
$ forall a. XDGReader a a -> XDGReader a (Maybe a)
In.maybeRead forall a b. (a -> b) -> a -> b
$ forall a. FilePath -> '[Env, Error XDGError, ReadFile a] >@> a
In.readStateFile FilePath
file