Skip to content

Commit f6acdd4

Browse files
authored
Merge pull request #7 from NativeScript/tdermendzhiev/fix-root-group-duplication
bugfix: Remove group reference from root group after group removal
2 parents 0aa91f6 + 848b424 commit f6acdd4

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
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;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"author": "Andrew Lunny <[email protected]>",
33
"name": "xcode",
44
"description": "parser for xcodeproj/project.pbxproj files",
5-
"version": "0.8.0",
65
"main":"index.js",
6+
"version": "1.5.0-NativeScript",
77
"repository": {
88
"url": "https://github.com/alunny/node-xcode.git"
99
},

0 commit comments

Comments
 (0)