Skip to content

Commit f85f635

Browse files
committed
fix: addPbxGroup nested folders with relative path
1 parent d607e87 commit f85f635

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/pbxProject.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -555,15 +555,16 @@ pbxProject.prototype.addPbxGroup = function (filePathsArray, name, path, sourceT
555555
}
556556

557557
var srcRootPath = $path.dirname($path.dirname(this.filepath));
558-
var file = new pbxFile($path.relative(srcRootPath, filePath));
558+
var relativePath = $path.relative(srcRootPath, filePath);
559+
var file = new pbxFile(opt.filesRelativeToProject ? relativePath : filePath);
559560
if (fs.existsSync(filePath) && fs.lstatSync(filePath).isDirectory()) {
560561
file.uuid = this.generateUuid();
561562
file.fileRef = file.uuid;
562563
this.addToPbxFileReferenceSection(file); // PBXFileReference
563564
this.addToPbxBuildFileSection(file);
564565
pbxGroup.children.push(pbxGroupChild(file));
565566
var files = fs.readdirSync(filePath).map(p => $path.join(filePath, p));
566-
this.addPbxGroup(files, $path.basename(filePath), filePath, null, {uuid: file.uuid});
567+
this.addPbxGroup(files, $path.basename(filePath), filePath, null, {uuid: file.uuid, filesRelativeToProject: opt.filesRelativeToProject});
567568
} else if (isSourceOrHeaderFileType(file.lastKnownFileType)) {
568569
file.uuid = this.generateUuid();
569570
file.fileRef = this.generateUuid();

0 commit comments

Comments
 (0)