Skip to content

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

Merged
merged 2 commits into from
Oct 27, 2016

Conversation

kperryua
Copy link
Contributor

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.

@kperryua
Copy link
Contributor Author

@swift-ci Please test and merge

1 similar comment
@kperryua
Copy link
Contributor Author

@swift-ci Please test and merge

Copy link
Contributor

@jrose-apple jrose-apple left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@kperryua
Copy link
Contributor Author

@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? {
Copy link
Contributor

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).

Copy link
Contributor

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).

Copy link
Contributor

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?

@parkera
Copy link
Contributor

parkera commented Oct 27, 2016

@shahmishal @erg what's going on with this PR? There seem to be plenty of idle nodes available.

@shahmishal
Copy link
Member

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 0bb1fc3 into swiftlang:master Oct 27, 2016
MaxDesiatov pushed a commit that referenced this pull request Sep 7, 2023
[pull] swiftwasm from main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants