Skip to content

Commit ab71445

Browse files
authored
Fix FileManager directories warning (#1288)
1 parent eb28f8f commit ab71445

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/FoundationEssentials/FileManager/FileManager+Directories.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ extension _FileManagerImpl {
8282
if domain == .systemDomainMask {
8383
domain = ._partitionedSystemDomainMask
8484
}
85-
let lastElement = domain == ._partitionedSystemDomainMask
86-
#else
87-
let lastElement = false
8885
#endif
86+
8987
let urls = Array(_SearchPathURLs(for: directory, in: domain, expandTilde: true))
90-
guard let url = lastElement ? urls.last : urls.first else {
88+
#if FOUNDATION_FRAMEWORK
89+
let url = domain == ._partitionedSystemDomainMask ? urls.last : urls.first
90+
#else
91+
let url = urls.first
92+
#endif
93+
94+
guard let url else {
9195
throw CocoaError(.fileReadUnknown)
9296
}
9397

0 commit comments

Comments
 (0)