0 | module System.File
 1 |
 2 | import Data.Buffer
 3 |
 4 | import public System.File.Buffer
 5 | import public System.File.Error
 6 | import public System.File.Handle
 7 | import public System.File.Meta
 8 | import public System.File.Mode
 9 | import public System.File.Permissions
10 | import public System.File.Process
11 | import public System.File.ReadWrite
12 | import public System.File.Types
13 | import public System.File.Virtual
14 |
15 | ||| Copy the file at the specified source to the given destination.
16 | ||| Returns the number of bytes that have been written upon a write error.
17 | |||
18 | ||| @ src  the file to copy
19 | ||| @ dest the place to copy the file to
20 | export
21 | copyFile : HasIO io => (src : String) -> (dest : String) -> io (Either (FileError, Int) ())
22 | copyFile src dest
23 |     = do Right buf <- createBufferFromFile src
24 |              | Left err => pure (Left (err, 0))
25 |          writeBufferToFile dest buf !(rawSize buf)
26 |