LIB: improve performance of copyDir

This commit is contained in:
Julian Ospald 2015-12-18 14:21:57 +01:00
parent 074ee45961
commit e67d68ab15
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -79,6 +79,7 @@ runFileOp _ = return ()
-- TODO: copy modes
-- TODO: allow renaming
copyDir :: DTInfoZipper -- ^ source dir
-> DTInfoZipper -- ^ destination dir
-> IO ()
@ -92,9 +93,10 @@ copyDir from@(Dir fn _ _, _) to@(Dir {}, _) = do
throwDestinationInSource fromp top
createDirectoryIfMissing False destdir
newDest <- zipLazy mkDirInfo mkFileInfo destdir
for_ (goAllDown from) $ \f -> do
newDest <- zipLazy mkDirInfo mkFileInfo destdir
for_ (goAllDown from) $ \f ->
-- TODO: maybe do this strict?
case f of
-- recreate symlink
sz@(Dir { name = n, dir = (DirInfo { sym = True }) }, _) -> do
@ -112,7 +114,6 @@ copyDir from@(File _ _, _) _ = throw $ NotADir (getFullPath from)
copyDir _ to@(File _ _, _) = throw $ NotADir (getFullPath to)
-- |Copies the given file.
--
-- This will throw an exception if any of the filepaths are not absolute