directory 1.3.4.0 → 1.3.5.0
raw patch · 4 files changed
+50/−11 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- System/Directory.hs +25/−4
- changelog.md +7/−0
- directory.cabal +2/−3
- tests/Xdg.hs +16/−4
System/Directory.hs view
@@ -143,6 +143,15 @@ normally at least one absolute path to each file system object. In some operating systems, it may also be possible to have paths which are relative to the current directory.++Unless otherwise documented:++* 'IO' operations in this package may throw any 'IOError'. No other types of+ exceptions shall be thrown.++* The list of possible 'IOErrorType's in the API documentation is not+ exhaustive. The full list may vary by platform and/or evolve over time.+ -} -----------------------------------------------------------------------------@@ -1336,13 +1345,21 @@ (`ioeAddLocation` "removeDirectoryLink") `modifyIOError` do removePathInternal linkToDirectoryIsDirectory path --- | Check whether the path refers to a symbolic link. An exception is thrown--- if the path does not exist or is inaccessible.+-- | Check whether an existing @path@ is a symbolic link. If @path@ is a+-- regular file or directory, 'False' is returned. If @path@ does not exist+-- or is otherwise inaccessible, an exception is thrown (see below). -- -- On Windows, this checks for @FILE_ATTRIBUTE_REPARSE_POINT@. In addition to -- symbolic links, the function also returns true on junction points. On -- POSIX systems, this checks for @S_IFLNK@. --+-- The operation may fail with:+--+-- * 'isDoesNotExistError' if the symbolic link does not exist; or+--+-- * 'isPermissionError' if the user is not permitted to read the symbolic+-- link.+-- -- @since 1.3.0.0 pathIsSymbolicLink :: FilePath -> IO Bool pathIsSymbolicLink path =@@ -1518,6 +1535,10 @@ -- Note: The directory may not actually exist, in which case you would need -- to create it with file mode @700@ (i.e. only accessible by the owner). --+-- As of 1.3.5.0, the environment variable is ignored if set to a relative+-- path, per revised XDG Base Directory Specification. See+-- <https://github.com/haskell/directory/issues/100 #100>.+-- -- @since 1.2.3.0 getXdgDirectory :: XdgDirectory -- ^ which special directory -> FilePath -- ^ a relative path that is appended@@ -1532,8 +1553,8 @@ XdgConfig -> "XDG_CONFIG_HOME" XdgCache -> "XDG_CACHE_HOME" case env of- Nothing -> getXdgDirectoryFallback getHomeDirectory xdgDir- Just path -> pure path+ Just path | isAbsolute path -> pure path+ _ -> getXdgDirectoryFallback getHomeDirectory xdgDir -- | Similar to 'getXdgDirectory' but retrieves the entire list of XDG -- directories.
changelog.md view
@@ -1,6 +1,13 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.5.0 (December 2019)++ * Revert change introduced in the version `1.3.3.2`: Non-absolute `XDG_*`+ environment variables are ignored. This behavior is according to+ [*XDG Base Directory Specification* version 0.7](https://specifications.freedesktop.org/basedir-spec/0.7/ar01s02.html)+ ([#100](https://github.com/haskell/directory/issues/100))+ ## 1.3.4.0 (July 2019) * `getXdgDirectory` and `getXdgDirectoryList` on Windows will now respect
directory.cabal view
@@ -1,6 +1,5 @@ name: directory-version: 1.3.4.0--- NOTE: Don't forget to update ./changelog.md+version: 1.3.5.0 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org@@ -55,7 +54,7 @@ include-dirs: . build-depends:- base >= 4.5 && < 4.14,+ base >= 4.5 && < 4.15, time >= 1.4 && < 1.10, filepath >= 1.3 && < 1.5 if os(windows)
tests/Xdg.hs view
@@ -3,8 +3,11 @@ #if MIN_VERSION_base(4, 7, 0) import qualified Data.List as List import System.Environment (setEnv, unsetEnv)-import System.FilePath ((</>), searchPathSeparator)+import System.FilePath (searchPathSeparator)+#if !defined(mingw32_HOST_OS)+import System.FilePath ((</>)) #endif+#endif #include "util.inl" main :: TestEnv -> IO ()@@ -24,12 +27,21 @@ T(expectEq) () (home </> ".config/mow") =<< getXdgDirectory XdgConfig "mow" #endif + -- unset variables, so env doesn't affect test running+ unsetEnv "XDG_DATA_HOME"+ unsetEnv "XDG_CONFIG_HOME"+ unsetEnv "XDG_CACHE_HOME"+ xdgData <- getXdgDirectory XdgData "ff"+ xdgConfig <- getXdgDirectory XdgConfig "oo"+ xdgCache <- getXdgDirectory XdgCache "rk"++ -- 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"- T(expectEq) () ("ar" </> "ff") =<< getXdgDirectory XdgData "ff"- T(expectEq) () ("aw" </> "oo") =<< getXdgDirectory XdgConfig "oo"- T(expectEq) () ("ba" </> "rk") =<< getXdgDirectory XdgCache "rk"+ T(expectEq) () xdgData =<< getXdgDirectory XdgData "ff"+ T(expectEq) () xdgConfig =<< getXdgDirectory XdgConfig "oo"+ T(expectEq) () xdgCache =<< getXdgDirectory XdgCache "rk" unsetEnv "XDG_CONFIG_DIRS" unsetEnv "XDG_DATA_DIRS"