mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-28 09:28:54 -06:00
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:
6
Make.hs
6
Make.hs
@@ -6,7 +6,7 @@ import System.Exit (ExitCode(..),die)
|
|||||||
import System.Environment (getArgs,lookupEnv)
|
import System.Environment (getArgs,lookupEnv)
|
||||||
import System.Process (rawSystem)
|
import System.Process (rawSystem)
|
||||||
import System.FilePath ((</>)) -- ,takeFileName,addExtension,dropExtension)
|
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)
|
import Control.Monad (when,unless)
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
@@ -61,14 +61,14 @@ copyOne :: String -> FilePath -> FilePath -> IO ()
|
|||||||
copyOne file from to = do
|
copyOne file from to = do
|
||||||
putStrLn $ "Copying [" ++ file ++ "] " ++ to
|
putStrLn $ "Copying [" ++ file ++ "] " ++ to
|
||||||
createDirectoryIfMissing True to
|
createDirectoryIfMissing True to
|
||||||
copyFile (from </> file) (to </> file)
|
copyFileWithMetadata (from </> file) (to </> file)
|
||||||
|
|
||||||
-- | Copy all files between directories
|
-- | Copy all files between directories
|
||||||
copyAll :: String -> FilePath -> FilePath -> IO ()
|
copyAll :: String -> FilePath -> FilePath -> IO ()
|
||||||
copyAll msg from to = do
|
copyAll msg from to = do
|
||||||
putStrLn $ "Copying [" ++ msg ++ "] " ++ to
|
putStrLn $ "Copying [" ++ msg ++ "] " ++ to
|
||||||
createDirectoryIfMissing True 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
|
-- | Remove dist directory
|
||||||
clean :: IO ()
|
clean :: IO ()
|
||||||
|
|||||||
Reference in New Issue
Block a user