From ecde9b6cb50bc470ae68284e9a161cd8e94b6d17 Mon Sep 17 00:00:00 2001 From: Alex da Franca Date: Sun, 20 Mar 2022 07:55:16 +0100 Subject: [PATCH] fixed relative path calculation --- Sources/xcresultparser/CoverageConverter.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/xcresultparser/CoverageConverter.swift b/Sources/xcresultparser/CoverageConverter.swift index 9af9433..17b468b 100644 --- a/Sources/xcresultparser/CoverageConverter.swift +++ b/Sources/xcresultparser/CoverageConverter.swift @@ -104,7 +104,8 @@ public struct CoverageConverter { guard !projectRoot.isEmpty else { return path } - let parts = path.components(separatedBy: "/\(projectRoot)") + let projectRootTrimmed = projectRoot.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + let parts = path.components(separatedBy: "/\(projectRootTrimmed)") guard parts.count > 1 else { return path }