use ShellParam type
So, I have a type checked safe handling of filenames starting with dashes, throughout the code.
This commit is contained in:
parent
7e5678bcf7
commit
fcdc4797a9
24 changed files with 151 additions and 124 deletions
14
CopyFile.hs
14
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 ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue