directory 1.3.6.2 → 1.3.7.0
raw patch · 8 files changed
+24/−1 lines, 8 filesdep ~Win32dep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Win32, time
API changes (from Hackage documentation)
+ System.Directory: XdgState :: XdgDirectory
+ System.Directory.Internal: XdgState :: XdgDirectory
Files
- System/Directory.hs +1/−0
- System/Directory/Internal/Common.hs +10/−0
- System/Directory/Internal/Posix.hsc +1/−0
- System/Directory/Internal/Windows.hsc +1/−0
- changelog.md +5/−0
- directory.cabal +1/−1
- tests/GetHomeDirectory001.hs +1/−0
- tests/Xdg.hs +4/−0
System/Directory.hs view
@@ -1569,6 +1569,7 @@ XdgData -> "XDG_DATA_HOME" XdgConfig -> "XDG_CONFIG_HOME" XdgCache -> "XDG_CACHE_HOME"+ XdgState -> "XDG_STATE_HOME" case env of Just path | isAbsolute path -> pure path _ -> getXdgDirectoryFallback getHomeDirectory xdgDir
System/Directory/Internal/Common.hs view
@@ -271,6 +271,16 @@ -- On Windows, the default is @%LOCALAPPDATA%@ -- (e.g. @C:\/Users\//\<user\>/\/AppData\/Local@). -- Can be considered as the user-specific equivalent of @\/var\/cache@.+ | XdgState+ -- ^ For data that should persist between (application) restarts,+ -- but that is not important or portable enough to the user that it+ -- should be stored in 'XdgData'.+ -- It uses the @XDG_STATE_HOME@ environment variable.+ -- On non-Windows sytems, the default is @~\/.local\/state@. On+ -- Windows, the default is @%LOCALAPPDATA%@+ -- (e.g. @C:\/Users\//\<user\>/\/AppData\/Local@).+ --+ -- @since 1.3.7.0 deriving (Bounded, Enum, Eq, Ord, Read, Show) -- | Search paths for various application data, as specified by the
System/Directory/Internal/Posix.hsc view
@@ -296,6 +296,7 @@ XdgData -> ".local/share" XdgConfig -> ".config" XdgCache -> ".cache"+ XdgState -> ".local/state" getXdgDirectoryListFallback :: XdgDirectoryList -> IO [FilePath] getXdgDirectoryListFallback xdgDirs =
System/Directory/Internal/Windows.hsc view
@@ -656,6 +656,7 @@ XdgData -> getFolderPath Win32.cSIDL_APPDATA XdgConfig -> getFolderPath Win32.cSIDL_APPDATA XdgCache -> getFolderPath win32_cSIDL_LOCAL_APPDATA+ XdgState -> getFolderPath win32_cSIDL_LOCAL_APPDATA getXdgDirectoryListFallback :: XdgDirectoryList -> IO [FilePath] getXdgDirectoryListFallback _ =
changelog.md view
@@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.7.0 (Sep 2021)++ * `getXdgDirectory` now supports `XdgState` (`XDG_STATE_HOME`).+ ([#121](https://github.com/haskell/directory/pull/121))+ ## 1.3.6.2 (May 2021) * Relax `Win32` version bounds to support 2.11.
directory.cabal view
@@ -1,5 +1,5 @@ name: directory-version: 1.3.6.2+version: 1.3.7.0 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org
tests/GetHomeDirectory001.hs view
@@ -10,6 +10,7 @@ _ <- getXdgDirectory XdgCache "test" _ <- getXdgDirectory XdgConfig "test" _ <- getXdgDirectory XdgData "test"+ _ <- getXdgDirectory XdgCache "test" _ <- getUserDocumentsDirectory _ <- getTemporaryDirectory return ()
tests/Xdg.hs view
@@ -31,17 +31,21 @@ unsetEnv "XDG_DATA_HOME" unsetEnv "XDG_CONFIG_HOME" unsetEnv "XDG_CACHE_HOME"+ unsetEnv "XDG_STATE_HOME" xdgData <- getXdgDirectory XdgData "ff" xdgConfig <- getXdgDirectory XdgConfig "oo" xdgCache <- getXdgDirectory XdgCache "rk"+ xdgState <- getXdgDirectory XdgState "aa" -- non-absolute paths are ignored, and the fallback is used setEnv "XDG_DATA_HOME" "ar" setEnv "XDG_CONFIG_HOME" "aw" setEnv "XDG_CACHE_HOME" "ba"+ setEnv "XDG_STATE_HOME" "uw" T(expectEq) () xdgData =<< getXdgDirectory XdgData "ff" T(expectEq) () xdgConfig =<< getXdgDirectory XdgConfig "oo" T(expectEq) () xdgCache =<< getXdgDirectory XdgCache "rk"+ T(expectEq) () xdgState =<< getXdgDirectory XdgState "aa" unsetEnv "XDG_CONFIG_DIRS" unsetEnv "XDG_DATA_DIRS"