Skip to content

Fix FileManager directories warning#1288

Merged
jmschonfeld merged 1 commit intoswiftlang:mainfrom
jmschonfeld:fix-fm-directories-warning
May 10, 2025
Merged

Fix FileManager directories warning#1288
jmschonfeld merged 1 commit intoswiftlang:mainfrom
jmschonfeld:fix-fm-directories-warning

Conversation

@jmschonfeld
Copy link
Copy Markdown
Contributor

Fixes a warning due to lastElement being unconditionally false in the non-FOUNDATION_FRAMEWORK branch

[2025-05-09T17:53:00.386Z] /build/swift-foundation/Sources/FoundationEssentials/FileManager/FileManager+Directories.swift:90:44: warning: will never be executed
[2025-05-09T17:53:00.386Z]  88 |         #endif
[2025-05-09T17:53:00.386Z]  89 |         let urls = Array(_SearchPathURLs(for: directory, in: domain, expandTilde: true))
[2025-05-09T17:53:00.386Z]  90 |         guard let url = lastElement ? urls.last : urls.first else {
[2025-05-09T17:53:00.386Z]     |                         |                  `- warning: will never be executed
[2025-05-09T17:53:00.386Z]     |                         `- note: condition always evaluates to false
[2025-05-09T17:53:00.386Z]  91 |             throw CocoaError(.fileReadUnknown)
[2025-05-09T17:53:00.386Z]  92 |         }

@jmschonfeld
Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@jmschonfeld jmschonfeld merged commit ab71445 into swiftlang:main May 10, 2025
15 checks passed
@jmschonfeld jmschonfeld deleted the fix-fm-directories-warning branch May 10, 2025 16:28
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.

2 participants