Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/XCParseCore/XCResultToolCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the interpolated string actually necessary? I assume the following would also work:

filenamePrefix + (attachment.filename ?? identifier)

let attachmentOutputPath = URL.init(fileURLWithPath: outputPath).appendingPathComponent(filename)
self.outputPath = attachmentOutputPath.path
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcparse/XCPParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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! 🎊")
Expand Down