Skip to content

Commit

Permalink
Fixed paths with whitespaces (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllDmeat authored Feb 28, 2024
1 parent 3e14bcd commit ebdeee5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Sources/DBXCResultParser/Models/DTO/DTO+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Foundation
extension ActionsInvocationRecordDTO {
init(from xcresultPath: URL) throws {
let filePath = try Constants.actionsInvocationRecord
try DBShell.execute("xcrun xcresulttool get --path \(xcresultPath.relativePath) --format json > \(filePath.relativePath)")
let command = "xcrun xcresulttool get --path '\(xcresultPath.relativePath)' --format json > '\(filePath.relativePath)'"
try DBShell.execute(command)
let data = try Data(contentsOf: filePath)
try FileManager.default.removeItem(atPath: filePath.relativePath)
self = try JSONDecoder().decode(ActionsInvocationRecordDTO.self, from: data)
Expand All @@ -21,7 +22,8 @@ extension ActionTestPlanRunSummariesDTO {
init(from xcresultPath: URL, refId: String? = nil) throws {
let refId = try (refId ?? ActionsInvocationRecordDTO(from: xcresultPath).testsRefId)
let filePath = try Constants.actionTestPlanRunSummaries
try DBShell.execute("xcrun xcresulttool get --path \(xcresultPath.relativePath) --format json --id \(refId) > \(filePath.relativePath)")
let command = "xcrun xcresulttool get --path '\(xcresultPath.relativePath)' --format json --id '\(refId)' > '\(filePath.relativePath)'"
try DBShell.execute(command)
let data = try Data(contentsOf: filePath)
try FileManager.default.removeItem(atPath: filePath.relativePath)
self = try JSONDecoder().decode(ActionTestPlanRunSummariesDTO.self, from: data)
Expand All @@ -32,7 +34,8 @@ extension ActionTestSummaryDTO {
init(from xcresultPath: URL, refId: String? = nil) throws {
let refId = try (refId ?? ActionsInvocationRecordDTO(from: xcresultPath).testsRefId)
let filePath = try Constants.actionTestSummary
try DBShell.execute("xcrun xcresulttool get --path \(xcresultPath.relativePath) --format json --id \(refId) > \(filePath.relativePath)")
let command = "xcrun xcresulttool get --path '\(xcresultPath.relativePath)' --format json --id '\(refId)' > '\(filePath.relativePath)'"
try DBShell.execute(command)
let data = try Data(contentsOf: filePath)
try FileManager.default.removeItem(atPath: filePath.relativePath)
self = try JSONDecoder().decode(ActionTestSummaryDTO.self, from: data)
Expand All @@ -42,7 +45,8 @@ extension ActionTestSummaryDTO {
extension Array where Element == CoverageDTO {
init(from xcresultPath: URL) throws {
let tempFilePath = try Constants.actionsInvocationRecord
try DBShell.execute("xcrun xccov view --report --only-targets --json \(xcresultPath.relativePath) > \(tempFilePath.relativePath)")
let command = "xcrun xccov view --report --only-targets --json '\(xcresultPath.relativePath)' > '\(tempFilePath.relativePath)'"
try DBShell.execute(command)
let data = try Data(contentsOf: tempFilePath)
try FileManager.default.removeItem(atPath: tempFilePath.relativePath)
self = try JSONDecoder().decode(Array<CoverageDTO>.self, from: data)
Expand Down

0 comments on commit ebdeee5

Please sign in to comment.