Skip to content

Commit bb83017

Browse files
tdermendjievKristian D. Dimitrov
authored andcommitted
bugfix: Remove group reference from root group after group removal
1 parent 176df7f commit bb83017

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/pbxFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function defaultGroup(fileRef) {
204204
function pbxFile(filepath, opt) {
205205
var opt = opt || {};
206206

207-
this.basename = path.basename(filepath);
207+
this.basename = opt.basename || path.basename(filepath);
208208
this.lastKnownFileType = opt.lastKnownFileType || detectType(filepath);
209209
this.group = detectGroup(this, opt);
210210

lib/pbxProject.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
581581
if (opt.isMain) {
582582
let mainGroup = this.findMainPbxGroup();
583583
if (mainGroup) {
584-
var file = new pbxFile($path.relative(this.filepath, path));
584+
var file = new pbxFile($path.relative(this.filepath, path), {basename: name});
585585
file.fileRef = pbxGroupUuid;
586586
mainGroup.children.push(pbxGroupChild(file));
587587
}
@@ -608,6 +608,13 @@ pbxProject.prototype.removePbxGroup = function(groupName, path) {
608608
this.removeFromPbxSourcesBuildPhase(file);
609609
}
610610

611+
var mainGroupChildren = this.findMainPbxGroup().children, i;
612+
for(i in mainGroupChildren) {
613+
if (mainGroupChildren[i].comment == name) {
614+
mainGroupChildren.splice(i, 1);
615+
}
616+
}
617+
611618
var section = this.hash.project.objects['PBXGroup'],
612619
key, itemKey;
613620

0 commit comments

Comments
 (0)