Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions Sources/XcodeProj/Objects/Project/PBXProjEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ final class PBXProjEncoder {
}

private func write(comment: String, to output: inout [String]) {
// Xcode writes */ inside a comment as (*)/, so the comment does not end early.
let comment = comment.contains("*/") ? comment.replacingOccurrences(of: "*/", with: "(*)/") : comment
output.append("/* \(comment) */")
}

Expand Down
11 changes: 11 additions & 0 deletions Tests/XcodeProjTests/Objects/Project/PBXProjEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@
lines.validate(line: "23766C2C1EAA3484007A9026 /* Info.plist */,", betweenLine: iosTestsChildrenStart, andLine: iosTestsChildrenEnd)
}

func test_navigator_group_name_containing_comment_end_when_iOSProject() throws {
try loadiOSProject()
let group = try XCTUnwrap(proj.groups.first { $0.name == "GroupWithoutFolder" })
group.name = "Group */ Name"

let encoded = encodeProject()
lines(fromFile: encoded).validate(line: "3CD1EAD92057638200DAEECB /* Group (*)/ Name */ = {")
let reread = try PBXProj(data: XCTUnwrap(encoded.data(using: .utf8)))
XCTAssertNotNil(reread.groups.first { $0.name == "Group */ Name" })
}

func test_navigator_groups_in_filename_order_when_iOSProject() throws {
try loadiOSProject()

Expand Down