path-io 1.4.0 → 1.4.1
raw patch · 4 files changed
+21/−7 lines, 4 filesdep ~path
Dependency ranges changed: path
Files
- CHANGELOG.md +5/−0
- Path/IO.hs +4/−5
- path-io.cabal +2/−2
- tests/Main.hs +10/−0
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Path IO 1.4.1++* Fixed a bug in `walkDirRel` that resulted in `NotAProperPrefix` exception+ every time the function was called.+ ## Path IO 1.4.0 * Added relative versions of some actions: `listDirRel`, `listDirRecurRel`,
Path/IO.hs view
@@ -14,6 +14,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} @@ -126,9 +127,6 @@ #if MIN_VERSION_directory(1,2,3) import System.Directory (XdgDirectory) #endif-#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (Monoid)-#endif ---------------------------------------------------------------------------- -- Actions on directories@@ -564,8 +562,9 @@ stripDir topdir #endif handler curdir subdirs files = do- -- These should not ever fail.- curdirRel <- stripTopdir curdir+ curdirRel <- if curdir == topdir+ then return $(mkRelDir ".")+ else stripTopdir curdir subdirsRel <- mapM stripTopdir subdirs filesRel <- mapM stripTopdir files action <- handler' curdirRel subdirsRel filesRel
path-io.cabal view
@@ -1,7 +1,7 @@ name: path-io-version: 1.4.0+version: 1.4.1 cabal-version: 1.18-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 license: BSD3 license-file: LICENSE.md author: Mark Karpov <markkarpov92@gmail.com>
tests/Main.hs view
@@ -36,6 +36,7 @@ describe "getCurrentDir" getCurrentDirSpec describe "setCurrentDir" setCurrentDirSpec describe "withCurrentDir" withCurrentDirSpec+ describe "walkDirRel" walkDirRelSpec #ifndef mingw32_HOST_OS -- NOTE We can't quite test this on Windows as well, because the -- environmental variables HOME and TMPDIR do not exist there.@@ -159,6 +160,15 @@ withCurrentDir dir $ getCurrentDir `shouldReturn` dir getCurrentDir `shouldNotReturn` dir++walkDirRelSpec :: SpecWith (Path Abs Dir)+walkDirRelSpec = it "does not throw exceptions" $ \dir -> do+ let handler curdir subdirs files = do+ curdir `shouldBe` $(mkRelDir ".")+ subdirs `shouldBe` []+ files `shouldBe` []+ return WalkFinish+ walkDirRel handler dir getHomeDirSpec :: SpecWith (Path Abs Dir) getHomeDirSpec =