summaryrefslogtreecommitdiff
path: root/CopyFile.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-02-28 16:10:16 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-02-28 16:18:55 -0400
commitfcdc4797a9ab2b792a9bb20f2ca9802b8f6d5a1e (patch)
tree0471848c11df7c1481d8c735eab1280d7684eddc /CopyFile.hs
parent7e5678bcf7cd78bd04520117201be37dc9d4d544 (diff)
use ShellParam type
So, I have a type checked safe handling of filenames starting with dashes, throughout the code.
Diffstat (limited to 'CopyFile.hs')
-rw-r--r--CopyFile.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/CopyFile.hs b/CopyFile.hs
index 73d911a29..4575fb08a 100644
--- a/CopyFile.hs
+++ b/CopyFile.hs
@@ -20,14 +20,12 @@ copyFile src dest = do
e <- doesFileExist dest
when e $
removeFile dest
- boolSystem "cp" opts
+ boolSystem "cp" [params, File src, File dest]
where
- opts = if SysConfig.cp_reflink_auto
- then ["--reflink=auto", src', dest']
+ params = if SysConfig.cp_reflink_auto
+ then Params "--reflink=auto"
else if SysConfig.cp_a
- then ["-a", src', dest']
+ then Params "-a"
else if SysConfig.cp_p
- then ["-p", src', dest']
- else [src', dest']
- src' = utilityEscape src
- dest' = utilityEscape dest
+ then Params "-p"
+ else Params ""