Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kreatoo committed May 12, 2024
1 parent ffc3a9d commit 13f19a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kpkg/modules/removeInternal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ proc tryRemoveFileCustom(file: string): bool =
# tryRemoveFile wrapper
# that checks if the file is a
# dir or not.
if dirExists(file) and not symlinkExists(file):
if dirExists(file):
return # We remove dirs on the second check
return tryRemoveFile(file)

Expand Down Expand Up @@ -88,8 +88,11 @@ proc removeInternal*(package: string, root = "",

# Double check so every empty dir gets removed
for line in listFiles:
if isEmptyOrWhitespace(toSeq(walkDir(root&"/"&line)).join("")) and dirExists(root&"/"&line) and not symlinkExists(root&"/"&line):
removeDir(root&"/"&line)
if isEmptyOrWhitespace(toSeq(walkDir(root&"/"&line)).join("")) and dirExists(root&"/"&line):
if symlinkExists(root&"/"&line):
removeFile(root&"/"&line)
else:
removeDir(root&"/"&line)
debug "dirs removed"

if not ignoreReplaces and not noRunfile:
Expand Down

0 comments on commit 13f19a2

Please sign in to comment.