Skip to content

Commit 692a08d

Browse files
committed
bugfix: Remove group reference from root group after group removal
1 parent 0aa91f6 commit 692a08d

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
@@ -118,7 +118,7 @@ function pbxFile(filepath, opt) {
118118
this.dirname = $path.dirname(filepath);
119119
}
120120

121-
this.basename = $path.basename(filepath);
121+
this.basename = opt.basename || $path.basename(filepath);
122122
this.path = correctPath(this, filepath);
123123
this.group = correctGroup(this);
124124

lib/pbxProject.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
376376
if (opt.isMain) {
377377
let mainGroup = this.findMainPbxGroup();
378378
if (mainGroup) {
379-
var file = new pbxFile($path.relative(this.filepath, path));
379+
var file = new pbxFile($path.relative(this.filepath, path), {basename: name});
380380
file.fileRef = pbxGroupUuid;
381381
mainGroup.children.push(pbxGroupChild(file));
382382
}
@@ -403,6 +403,13 @@ pbxProject.prototype.removePbxGroup = function(name, path) {
403403
this.removeFromPbxSourcesBuildPhase(file);
404404
}
405405

406+
var mainGroupChildren = this.findMainPbxGroup().children, i;
407+
for(i in mainGroupChildren) {
408+
if (mainGroupChildren[i].comment == name) {
409+
mainGroupChildren.splice(i, 1);
410+
}
411+
}
412+
406413
//copied from https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L527
407414
var section = this.hash.project.objects['PBXGroup'],
408415
key, itemKey;

0 commit comments

Comments
 (0)