Support filenames that start with a dash; when such a file is passed to a utility it will be escaped to avoid it being interpreted as an option.

This commit is contained in:
Joey Hess 2011-02-25 01:13:01 -04:00
parent e61b47bc8a
commit 836e71297b
9 changed files with 29 additions and 10 deletions

View file

@ -23,9 +23,11 @@ copyFile src dest = do
boolSystem "cp" opts
where
opts = if SysConfig.cp_reflink_auto
then ["--reflink=auto", src, dest]
then ["--reflink=auto", src', dest']
else if SysConfig.cp_a
then ["-a", src, dest]
then ["-a", src', dest']
else if SysConfig.cp_p
then ["-p", src, dest]
else [src, dest]
then ["-p", src', dest']
else [src', dest']
src' = utilityEscape src
dest' = utilityEscape dest