diff --git a/Source/SwiftLintCore/Models/Location.swift b/Source/SwiftLintCore/Models/Location.swift index 1c600ac98..b17368a38 100644 --- a/Source/SwiftLintCore/Models/Location.swift +++ b/Source/SwiftLintCore/Models/Location.swift @@ -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.