From e67d68ab15f9fd46715e7eec245814bec381e4f1 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Fri, 18 Dec 2015 14:21:57 +0100 Subject: [PATCH] LIB: improve performance of copyDir --- src/IO/File.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/IO/File.hs b/src/IO/File.hs index 3b9f7a2..2e4cdaa 100644 --- a/src/IO/File.hs +++ b/src/IO/File.hs @@ -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