diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-15 21:37:45 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-15 21:37:45 -0500 |
| commit | f4d863d3ddb8ac8b6295476d33351e8db0e4d90a (patch) | |
| tree | 81ce6f5d58dd62ba75ca338c1c729137731a5b86 | |
| parent | e293172cf29d45f6c85e982b5ba9df57cb208bbc (diff) | |
| download | nimterop-f4d863d3ddb8ac8b6295476d33351e8db0e4d90a.tar.gz nimterop-f4d863d3ddb8ac8b6295476d33351e8db0e4d90a.zip | |
rm only if exists
| -rw-r--r-- | nimterop/build.nim | 8 |
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 |
