path-io 1.3.0 → 1.3.1
raw patch · 3 files changed
+22/−7 lines, 3 filesdep +dlist
Dependencies added: dlist
Files
- CHANGELOG.md +4/−0
- Path/IO.hs +14/−4
- path-io.cabal +4/−3
CHANGELOG.md view
@@ -1,3 +1,7 @@+## Path IO 1.3.1++* Made `listDirRecur` faster for deep directory trees.+ ## Path IO 1.3.0 * Change the default behavior of recursive traversal APIs to not follow
Path/IO.hs view
@@ -99,6 +99,7 @@ , getModificationTime ) where +import Control.Arrow ((***)) import Control.Monad import Control.Monad.Catch import Control.Monad.IO.Class (MonadIO (..))@@ -111,6 +112,7 @@ import Path import System.IO (Handle) import System.IO.Error (isDoesNotExistError)+import qualified Data.DList as DList import qualified Data.Set as S import qualified System.Directory as D import qualified System.FilePath as F@@ -335,9 +337,12 @@ listDirRecur :: (MonadIO m, MonadThrow m) => Path b Dir -- ^ Directory to list -> m ([Path Abs Dir], [Path Abs File]) -- ^ Sub-directories and files-listDirRecur = walkDirAccum (Just excludeSymlinks) (\_ d f -> return (d, f))- where excludeSymlinks _ subdirs _ =- liftM WalkExclude (filterM isSymlink subdirs)+listDirRecur dir = (DList.toList *** DList.toList)+ `liftM` walkDirAccum (Just excludeSymlinks) writer dir+ where+ excludeSymlinks _ subdirs _ =+ WalkExclude `liftM` filterM isSymlink subdirs+ writer _ ds fs = return (DList.fromList ds, DList.fromList fs) -- | Copies a directory recursively. It /does not/ follow symbolic links and -- preserves permissions when possible. If the destination directory already@@ -387,7 +392,12 @@ -> Path Abs Dir -> Path Abs t -> m (Path Abs t)- swapParent old new path = (new </>) `liftM` stripDir old path+ swapParent old new path = (new </>) `liftM`+#if MIN_VERSION_path(0,6,0)+ stripProperPrefix old path+#else+ stripDir old path+#endif tdirs <- mapM (swapParent bsrc bdest) dirs tfiles <- mapM (swapParent bsrc bdest) files ensureDir bdest
path-io.cabal view
@@ -1,5 +1,5 @@ name: path-io-version: 1.3.0+version: 1.3.1 cabal-version: >= 1.10 tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.1 license: BSD3@@ -24,9 +24,10 @@ build-depends: base >= 4.7 && < 5.0 , containers , directory >= 1.2.2 && < 1.4+ , dlist >= 0.8 && < 0.9 , exceptions >= 0.8 && < 0.9 , filepath >= 1.2 && < 1.5- , path >= 0.5 && < 0.6+ , path >= 0.5 && < 0.7 , temporary >= 1.1 && < 1.3 , time >= 1.4 && < 1.9 , transformers >= 0.3 && < 0.6@@ -49,7 +50,7 @@ build-depends: base >= 4.7 && < 5.0 , exceptions >= 0.8 && < 0.9 , hspec >= 2.0 && < 3.0- , path >= 0.5 && < 0.6+ , path >= 0.5 && < 0.7 , path-io , transformers >= 0.3 && < 0.6 , unix-compat