Skip to content

subpathsOfDirectory(atPath:) should throw on empty paths #869

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 1 commit into from
Aug 20, 2024

Conversation

jmschonfeld
Copy link
Contributor

This should hopefully be the last of the Windows FileManager fixups for now 🙂

A swift-corelibs-foundation test revealed that subpathsOfDirectory(atPath: "") throws on Darwin/Linux but returns an empty array on Windows. We should make it behave the same by throwing an error (however Windows currently throws .fileReadInvalidFileName for empty paths unlike Darwin/Linux which reports that the file doesn't exist, so we maintain that consistency with other APIs here)

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not change the error to match the other platforms?

@jmschonfeld
Copy link
Contributor Author

Any reason to not change the error to match the other platforms?

Not in particular, although I think that may be best done as a followup since there are a lot of FileManager APIs that return fileReadInvalidFileName on Windows but a variant of fileReadNoSuchFile on Linux/Darwin. I'm fine with making them consistent, but it might be easiest to do that in one chunk unless you think I should go ahead and update this one now while I'm here

@jmschonfeld jmschonfeld merged commit df5aa9b into swiftlang:main Aug 20, 2024
3 checks passed
@jmschonfeld jmschonfeld deleted the windows/enumerate-empty-dir branch August 20, 2024 18:32
cthielen pushed a commit to cthielen/swift-foundation that referenced this pull request Nov 8, 2024
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.

3 participants