Skip to content

Commit 9b8b05d

Browse files
committed
Use relative paths for pbxFiles
1 parent 8ea09fb commit 9b8b05d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/pbxProject.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,8 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
318318
isa: 'PBXGroup',
319319
children: [],
320320
name: name,
321-
path: path,
322321
sourceTree: sourceTree ? sourceTree : '"<group>"'
323-
},
322+
},//path is mandatory only for the main group
324323
fileReferenceSection = this.pbxFileReferenceSection(),
325324
filePathToReference = {};
326325

@@ -335,6 +334,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
335334
}
336335

337336
for (var index = 0; index < filePathsArray.length; index++) {
337+
338338
var filePath = filePathsArray[index],
339339
filePathQuoted = "\"" + filePath + "\"";
340340
if (filePathToReference[filePath]) {
@@ -345,7 +345,8 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
345345
continue;
346346
}
347347

348-
var file = new pbxFile(filePath);
348+
var srcRootPath = $path.join(this.filepath, "../..");
349+
var file = new pbxFile($path.relative(srcRootPath, filePath));
349350
if (fs.lstatSync(filePath).isDirectory()) {
350351
file.uuid = this.generateUuid();
351352
file.fileRef = file.uuid;
@@ -375,7 +376,7 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
375376
if (opt.isMain) {
376377
let mainGroup = this.findMainPbxGroup();
377378
if (mainGroup) {
378-
var file = new pbxFile(pbxGroup.path);
379+
var file = new pbxFile($path.relative(this.filepath, path));
379380
file.fileRef = pbxGroupUuid;
380381
mainGroup.children.push(pbxGroupChild(file));
381382
}

0 commit comments

Comments
 (0)