in lib/pbxProject.js [494:543]
pbxProject.prototype.addPbxGroup = function(filePathsArray, name, path, sourceTree) {
var groups = this.hash.project.objects['PBXGroup'],
pbxGroupUuid = this.generateUuid(),
commentKey = f("%s_comment", pbxGroupUuid),
pbxGroup = {
isa: 'PBXGroup',
children: [],
name: name,
path: path,
sourceTree: sourceTree ? sourceTree : '"<group>"'
},
fileReferenceSection = this.pbxFileReferenceSection(),
filePathToReference = {};
for (var key in fileReferenceSection) {
// only look for comments
if (!COMMENT_KEY.test(key)) continue;
var fileReferenceKey = key.split(COMMENT_KEY)[0],
fileReference = fileReferenceSection[fileReferenceKey];
filePathToReference[fileReference.path] = { fileRef: fileReferenceKey, basename: fileReferenceSection[key] };
}
for (var index = 0; index < filePathsArray.length; index++) {
var filePath = filePathsArray[index],
filePathQuoted = "\"" + filePath + "\"";
if (filePathToReference[filePath]) {
pbxGroup.children.push(pbxGroupChild(filePathToReference[filePath]));
continue;
} else if (filePathToReference[filePathQuoted]) {
pbxGroup.children.push(pbxGroupChild(filePathToReference[filePathQuoted]));
continue;
}
var file = new pbxFile(filePath);
file.uuid = this.generateUuid();
file.fileRef = this.generateUuid();
this.addToPbxFileReferenceSection(file); // PBXFileReference
this.addToPbxBuildFileSection(file); // PBXBuildFile
pbxGroup.children.push(pbxGroupChild(file));
}
if (groups) {
groups[pbxGroupUuid] = pbxGroup;
groups[commentKey] = name;
}
return { uuid: pbxGroupUuid, pbxGroup: pbxGroup };
}