Skip to content

Commit 836a9a8

Browse files
committed
fix: group name isn't wrapped in quotes if it conatins a space
1 parent 5de81d8 commit 836a9a8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/pbxProject.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,11 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
539539
var groups = this.hash.project.objects['PBXGroup'],
540540
pbxGroupUuid = opt.uuid || this.generateUuid(),
541541
commentKey = f("%s_comment", pbxGroupUuid),
542+
groupName = name.indexOf(" ") >= 0 && name[0] !== `"` ? `"${name}"` : name,
542543
pbxGroup = {
543544
isa: 'PBXGroup',
544545
children: [],
545-
name: name,
546+
name: groupName,
546547
sourceTree: sourceTree ? sourceTree : '"<group>"'
547548
},
548549
fileReferenceSection = this.pbxFileReferenceSection(),
@@ -2340,7 +2341,7 @@ pbxProject.prototype.findPBXGroupKeyAndType = function(criteria, groupType) {
23402341

23412342
var group = groups[key];
23422343
if (criteria && criteria.path && criteria.name) {
2343-
if (criteria.path === group.path && criteria.name === group.name) {
2344+
if (criteria.path === group.path && (criteria.name === group.name || `"${criteria.name}"` === group.name)) {
23442345
target = key;
23452346
break
23462347
}
@@ -2352,7 +2353,7 @@ pbxProject.prototype.findPBXGroupKeyAndType = function(criteria, groupType) {
23522353
}
23532354
}
23542355
else if (criteria && criteria.name) {
2355-
if (criteria.name === group.name) {
2356+
if (criteria.name === group.name || `"${criteria.name}"` === group.name) {
23562357
target = key;
23572358
break
23582359
}

0 commit comments

Comments
 (0)