Skip to content

Commit

Permalink
Replace custom walkdir by Nim's walkdir because of unexpected crash i…
Browse files Browse the repository at this point in the history
…n some environments
  • Loading branch information
dmknght committed Dec 14, 2024
1 parent 593e1b4 commit fea40bf
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/scanners/scanners.nim
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ proc scanners_cl_scan_files*(scan_ctx: var ScanCtx, list_path_objects: seq[strin

try:
for each_scan_object in list_path_objects:
case getFileInfo(each_scan_object).kind
of pcDir:
fscanner_walk_dir_rec(file_scanner, each_scan_object, virname, scanned)
of pcLinkToDir:
fscanner_walk_dir_rec(file_scanner, each_scan_object, virname, scanned)
let current_type = getFileInfo(each_scan_object).kind
if current_type == pcDir or current_type == pcLinkToDir:
for each_path in walkDirRec(each_scan_object):
let path_type = getFileInfo(each_path).kind
if path_type == pcFile or path_type == pcLinkToFile:
fscanner_scan_file(file_scanner, each_scan_object, virname, scanned)
else:
fscanner_scan_file(file_scanner, each_scan_object, virname, scanned)
# case getFileInfo(each_scan_object).kind
# of pcDir:
# fscanner_walk_dir_rec(file_scanner, each_scan_object, virname, scanned)
# of pcLinkToDir:
# fscanner_walk_dir_rec(file_scanner, each_scan_object, virname, scanned)
# else:
# fscanner_scan_file(file_scanner, each_scan_object, virname, scanned)
except KeyboardInterrupt:
return
except:
Expand Down

0 comments on commit fea40bf

Please sign in to comment.