join / -> reduce append

This commit is contained in:
Roman Lavrov
2025-12-23 15:08:35 +01:00
committed by Danny Mösch
parent cd29a9aa50
commit 67973cb419
+3 -1
View File
@@ -32,7 +32,9 @@ public struct Location: CustomStringConvertible, Comparable, Codable, Sendable {
return file
}
return fileComponents.dropFirst(baseComponents.count).joined(separator: "/")
return fileComponents.dropFirst(baseComponents.count).reduce(into: URL(filePath: "")) {
$0.append(component: $1)
}.relativePath
}
/// Creates a `Location` by specifying its properties directly.