rm only if exists
This commit is contained in:
parent
e293172cf2
commit
f4d863d3dd
1 changed files with 7 additions and 1 deletions
|
|
@ -107,8 +107,14 @@ proc rmFile*(source: string, dir = false) =
|
||||||
"del /s/q/f"
|
"del /s/q/f"
|
||||||
else:
|
else:
|
||||||
"rm -rf"
|
"rm -rf"
|
||||||
|
exists =
|
||||||
|
if dir:
|
||||||
|
dirExists(source)
|
||||||
|
else:
|
||||||
|
fileExists(source)
|
||||||
|
|
||||||
discard execAction(&"{cmd} {source.sanitizePath}", retry = 2)
|
if exists:
|
||||||
|
discard execAction(&"{cmd} {source.sanitizePath}", retry = 2)
|
||||||
|
|
||||||
proc rmDir*(dir: string) =
|
proc rmDir*(dir: string) =
|
||||||
## Remove a directory or pattern at compile time
|
## Remove a directory or pattern at compile time
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue