From 7938281033caf682f2bba59bc31635a376ec24b2 Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Tue, 3 Dec 2019 20:30:02 -0700 Subject: [PATCH] added numbering to the filenames of the attachments that are extracted --- Sources/XCParseCore/XCResultToolCommand.swift | 4 ++-- Sources/xcparse/XCPParser.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/XCParseCore/XCResultToolCommand.swift b/Sources/XCParseCore/XCResultToolCommand.swift index 433dec0..86cde17 100644 --- a/Sources/XCParseCore/XCResultToolCommand.swift +++ b/Sources/XCParseCore/XCResultToolCommand.swift @@ -80,12 +80,12 @@ open class XCResultToolCommand { super.init(withXCResult: xcresult, process: process) } - public init(withXCResult xcresult: XCResult, attachment: ActionTestAttachment, outputPath: String) { + public init(withXCResult xcresult: XCResult, attachment: ActionTestAttachment, outputPath: String, filenamePrefix: String = "") { if let identifier = attachment.payloadRef?.id { self.id = identifier; // Now let's figure out the filename & path - let filename = attachment.filename ?? identifier + let filename = filenamePrefix + "\(attachment.filename ?? identifier)" let attachmentOutputPath = URL.init(fileURLWithPath: outputPath).appendingPathComponent(filename) self.outputPath = attachmentOutputPath.path } diff --git a/Sources/xcparse/XCPParser.swift b/Sources/xcparse/XCPParser.swift index 9e78ea3..4c5222a 100644 --- a/Sources/xcparse/XCPParser.swift +++ b/Sources/xcparse/XCPParser.swift @@ -326,7 +326,7 @@ class XCPParser { for (index, attachment) in attachments.enumerated() { progressBar.update(step: index, total: attachments.count, text: "Extracting \"\(attachment.filename ?? "Unknown Filename")\"") - XCResultToolCommand.Export(withXCResult: xcresult, attachment: attachment, outputPath: screenshotDirectoryURL.path).run() + XCResultToolCommand.Export(withXCResult: xcresult, attachment: attachment, outputPath: screenshotDirectoryURL.path, filenamePrefix: "\(index)-").run() } progressBar.update(step: attachments.count, total: attachments.count, text: "🎊 Export complete! 🎊")