Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added numbering to the filenames of the attachments that are extracted #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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