-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Ensure directory URL enumerator error handler block is invoked with non-nil URL #5491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci Please test and merge |
1 similar comment
@swift-ci Please test and merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a reasonable fix. One comment on the API notes.
@@ -659,6 +659,9 @@ Classes: | |||
- Selector: 'URLForPublishingUbiquitousItemAtURL:expirationDate:error:' | |||
SwiftName: url(forPublishingUbiquitousItemAt:expiration:) | |||
MethodKind: Instance | |||
- Selector: 'enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:' | |||
MethodKind: Instance | |||
Availability: nonswift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Availability: nonswift
, please use SwiftPrivate: true
. That way it doesn't show up in overload resolution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I'll make that change.
@swift-ci Please test and merge |
@@ -45,4 +52,16 @@ extension FileManager { | |||
} | |||
throw error! | |||
} | |||
|
|||
@available(OSX 10.6, iOS 4.0, *) | |||
public func enumerator(at url: URL, includingPropertiesForKeys keys: [URLResourceKey]?, options mask: FileManager.DirectoryEnumerationOptions = [], errorHandler handler: ((URL, Error) -> Bool)? = nil) -> FileManager.DirectoryEnumerator? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, this should probably be marked final
and @nonobjc
(per discussion with @parkera).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to tackle that later (it would be a source breaking change at this point I believe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we at least get it right on new methods?
@shahmishal @erg what's going on with this PR? There seem to be plenty of idle nodes available. |
@swift-ci Please test and merge |
[pull] swiftwasm from main
A band-aid for incorrect Objective-C API behavior, wherein no NSURL is ever passed to the
errorHandler
block. This diff extracts the relevant URL from the error and passes that instead. There is already a guarantee that either the URL or path key will be present in the error.