1
0
forked from GitHub/gf-rgl

use copyFileWithMetadata instead of copyFile

to preserve timestamps #43 ([but also preserves other stuff](http://hackage.haskell.org/package/directory-1.3.3.1/docs/System-Directory.html#v:copyFileWithMetadata))
This commit is contained in:
bruno cuconato
2018-10-24 14:06:45 +00:00
committed by GitHub
parent 4e646d5c7b
commit 77a7b7e51c

View File

@@ -6,7 +6,7 @@ import System.Exit (ExitCode(..),die)
import System.Environment (getArgs,lookupEnv)
import System.Process (rawSystem)
import System.FilePath ((</>)) -- ,takeFileName,addExtension,dropExtension)
import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile)
import System.Directory (createDirectoryIfMissing,copyFileWithMetadata,getDirectoryContents,removeDirectoryRecursive,findFile)
import Control.Monad (when,unless)
main :: IO ()
@@ -61,14 +61,14 @@ copyOne :: String -> FilePath -> FilePath -> IO ()
copyOne file from to = do
putStrLn $ "Copying [" ++ file ++ "] " ++ to
createDirectoryIfMissing True to
copyFile (from </> file) (to </> file)
copyFileWithMetadata (from </> file) (to </> file)
-- | Copy all files between directories
copyAll :: String -> FilePath -> FilePath -> IO ()
copyAll msg from to = do
putStrLn $ "Copying [" ++ msg ++ "] " ++ to
createDirectoryIfMissing True to
mapM_ (\file -> when (file /= "." && file /= "..") $ copyFile (from </> file) (to </> file)) =<< getDirectoryContents from
mapM_ (\file -> when (file /= "." && file /= "..") $ copyFileWithMetadata (from </> file) (to </> file)) =<< getDirectoryContents from
-- | Remove dist directory
clean :: IO ()