Skip to content

Commit e11cc27

Browse files
committed
[pbxWriter] fix sections with multiple entries
1 parent 369209d commit e11cc27

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

lib/pbxWriter.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,28 @@ pbxWriter.prototype.writeSectionComment = function (name, begin) {
189189
}
190190

191191
pbxWriter.prototype.writeSection = function (section) {
192-
var id = section.id,
193-
comment = section[id + '_comment'],
194-
object = section[id];
192+
var key, obj, cmt;
193+
194+
// section should only contain objects
195+
for (key in section) {
196+
if (COMMENT_KEY.test(key)) continue;
195197

196-
this.write("%s /* %s */ = {\n", id, comment);
198+
cmt = comment(key, section);
199+
obj = section[key]
197200

198-
this.indentLevel++
201+
if (cmt) {
202+
this.write("%s /* %s */ = {\n", key, cmt);
203+
} else {
204+
this.write("%s = {\n", key);
205+
}
199206

200-
this.writeObject(object)
207+
this.indentLevel++
201208

202-
this.indentLevel--
209+
this.writeObject(obj)
203210

204-
this.write("};\n");
211+
this.indentLevel--
212+
this.write("};\n");
213+
}
205214
}
206215

207216
module.exports = pbxWriter;

0 commit comments

Comments
 (0)