diff --git a/mac/Sources/Byre/TranscriptBuilder.swift b/mac/Sources/Byre/TranscriptBuilder.swift index f5e178c..4006b7c 100644 --- a/mac/Sources/Byre/TranscriptBuilder.swift +++ b/mac/Sources/Byre/TranscriptBuilder.swift @@ -878,7 +878,10 @@ private func toolTarget(_ input: (any Sendable)?, _ root: String) -> String { } private func relative(_ path: String, _ root: String) -> String { - !root.isEmpty && path.hasPrefix("\(root)/") ? String(path.dropFirst(root.count + 1)) : path + guard !root.isEmpty, let r = path.range(of: "\(root)/", options: [.anchored, .caseInsensitive]) else { + return path + } + return String(path[r.upperBound...]) } private func resultText(_ content: (any Sendable)?) -> String {