Skip to content

Commit a3f5cc0

Browse files
committed
Foundation: allow failure in attribute query
The path being removed may not exist. Permit the `attributes(of:)` to fail and propagate the exception.
1 parent 3cd1f79 commit a3f5cc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/FileManager+Win32.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ extension FileManager {
406406
guard alreadyConfirmed || shouldRemoveItemAtPath(path, isURL: isURL) else {
407407
return
408408
}
409-
let faAttributes = try! windowsFileAttributes(atPath: path)
409+
let faAttributes = try windowsFileAttributes(atPath: path)
410410
if faAttributes.dwFileAttributes & DWORD(FILE_ATTRIBUTE_DIRECTORY) == 0 {
411411
if !path.withCString(encodedAs: UTF16.self, DeleteFileW) {
412412
throw _NSErrorWithWindowsError(GetLastError(), reading: false)

0 commit comments

Comments
 (0)