aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nimterop/build.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim
index f3f1b48..49bc15d 100644
--- a/nimterop/build.nim
+++ b/nimterop/build.nim
@@ -107,8 +107,14 @@ proc rmFile*(source: string, dir = false) =
"del /s/q/f"
else:
"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) =
## Remove a directory or pattern at compile time