Skip to content

Commit db63ab3

Browse files
authored
(128078561) Fix FileManager bugs found by scl-f (#609)
1 parent d1ace94 commit db63ab3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Sources/FoundationEssentials/FileManager/FileManager+Files.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ func _readFileAttributePrimitive<T: BinaryInteger>(_ value: Any?, as type: T.Typ
7878
}
7979
#endif
8080

81-
if let binInt = value as? (any BinaryInteger), let result = T(exactly: binInt) {
81+
if let exact = value as? T {
82+
return exact
83+
} else if let binInt = value as? (any BinaryInteger), let result = T(exactly: binInt) {
8284
return result
8385
}
8486
return nil

Sources/FoundationEssentials/FileManager/SearchPaths/FileManager+XDGSearchPaths.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private enum _XDGUserDirectory: String {
135135

136136
let path = String(line[line.unicodeScalars.index(after: equalsIdx)...])._trimmingWhitespace()
137137
if !path.isEmpty {
138-
entries[directory] = home.appending(path: path)
138+
entries[directory] = URL(filePath: path, directoryHint: .isDirectory, relativeTo: home)
139139
}
140140
} else {
141141
return nil // Incorrect syntax.

0 commit comments

Comments
 (0)