Skip to content

Commit d86b18b

Browse files
committed
fix: User file.uuid for the newly created group's fileRef instead of generating a new uuid
Generating a new uuid for the fileRef section will have folders as folder references instead of groups
1 parent 6b1453b commit d86b18b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/pbxProject.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var util = require('util'),
22
f = util.format,
33
EventEmitter = require('events').EventEmitter,
4-
$path = require('path'),
4+
path = require('path'),
55
uuid = require('node-uuid'),
66
fork = require('child_process').fork,
77
pbxWriter = require('./pbxWriter'),
@@ -291,7 +291,7 @@ pbxProject.prototype.findMainPbxGroup = function () {
291291
var groups = this.hash.project.objects['PBXGroup'];
292292
var candidates = [];
293293
for (var key in groups) {
294-
if (groups[key].path == undefined && groups[key].name == undefined && groups[key].isa) {
294+
if (!groups[key].path && !groups[key].name && groups[key].isa) {
295295
candidates.push(groups[key]);
296296
}
297297
}
@@ -304,7 +304,7 @@ pbxProject.prototype.findMainPbxGroup = function () {
304304

305305
pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceTree, opt) {
306306
var groups = this.hash.project.objects['PBXGroup'],
307-
pbxGroupUuid = opt.uuid ? opt.uuid : this.generateUuid(),
307+
pbxGroupUuid = opt.uuid || this.generateUuid(),
308308
commentKey = f("%s_comment", pbxGroupUuid),
309309
pbxGroup = {
310310
isa: 'PBXGroup',
@@ -340,7 +340,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
340340
var file = new pbxFile(filePath);
341341
if (fs.lstatSync(filePath).isDirectory()) {
342342
file.uuid = this.generateUuid();
343-
file.fileRef = this.generateUuid();
343+
file.fileRef = file.uuid;
344344
this.addToPbxFileReferenceSection(file); // PBXFileReference
345345
this.addToPbxBuildFileSection(file);
346346
pbxGroup.children.push(pbxGroupChild(file));

0 commit comments

Comments
 (0)