Commit f8e4c1ed authored by ijones's avatar ijones
Browse files

preserve permissions on copyFile

parent 954951e3
......@@ -67,7 +67,8 @@ import qualified Distribution.Simple.GHCPackageConfig as GHC (localPackageConfig
-- base
import Control.Monad(when, unless)
import Directory(setCurrentDirectory, doesFileExist,
doesDirectoryExist, getCurrentDirectory)
doesDirectoryExist, getCurrentDirectory,
getPermissions, Permissions(..))
import System.Cmd(system)
import System.Exit(ExitCode(..))
......@@ -120,6 +121,8 @@ tests = [TestLabel "testing the wash2hs package" $ TestCase $
assertCmd "./setup install --user" "wash2hs install"
doesFileExist ",tmp/bin/wash2hs"
>>= assertBool "wash2hs didn't put executable into place."
perms <- getPermissions ",tmp/bin/wash2hs"
assertBool "wash2hs isn't +x" (executable perms)
setCurrentDirectory oldDir,
TestLabel "testing the HUnit package" $ TestCase $
do oldDir <- getCurrentDirectory
......
......@@ -315,11 +315,13 @@ mkLibName pref lib = pathJoin [pref, ("libHS" ++ lib ++ ".a")]
pathJoin :: [String] -> FilePath
pathJoin = concat . intersperse pathSeparatorStr
-- FIX: does not preserve dates, does not set permissions
-- |Preserves permissions, FIX: does not preserve dates
copyFile :: FilePath -> FilePath -> IO ()
copyFile src dest
| dest == src = fail "copyFile: source and destination are the same file"
| otherwise = readFile src >>= writeFile dest
| otherwise = do readFile src >>= writeFile dest
p <- getPermissions src
setPermissions dest p
partitionIO :: (a -> IO Bool) -> [a] -> IO ([a], [a])
partitionIO f l
......
* 0.1
RC:
** grep for "FIX"
** make installed binaries executable! (posix?)
** sanity check for both library and executables == nothing.
- also, if they have Nothing, and yet BuildInfo is non-empty, this
should probably be a warning.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment