Skip to content

Commit e22cb7f

Browse files
authored
[Windows] FileManager.enumerator(at:) default error handler should continue rather than exiting (#5136) (#5138)
1 parent 21b3196 commit e22cb7f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: Sources/Foundation/FileManager+Win32.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ extension FileManager {
322322
override func nextObject() -> Any? {
323323
func firstValidItem() -> URL? {
324324
while let url = _stack.popLast() {
325-
if !FileManager.default.fileExists(atPath: url.path) {
326-
guard let handler = _errorHandler else { return nil }
327-
if !handler(url, _NSErrorWithWindowsError(GetLastError(), reading: true, paths: [url.path])) {
325+
guard FileManager.default.fileExists(atPath: url.path) else {
326+
if let handler = _errorHandler, !handler(url, _NSErrorWithWindowsError(GetLastError(), reading: true, paths: [url.path])) {
328327
return nil
329328
}
329+
continue
330330
}
331331
_lastReturned = url
332332
return _lastReturned

0 commit comments

Comments
 (0)