in lib/pbxProject.js [2124:2178]
pbxProject.prototype.addDataModelDocument = function(filePath, group, opt) {
if (!group) {
group = 'Resources';
}
if (!this.getPBXGroupByKey(group)) {
group = this.findPBXGroupKey({ name: group });
}
var file = new pbxFile(filePath, opt);
if (!file || this.hasFile(file.path)) return null;
file.fileRef = this.generateUuid();
this.addToPbxGroup(file, group);
if (!file) return false;
file.target = opt ? opt.target : undefined;
file.uuid = this.generateUuid();
this.addToPbxBuildFileSection(file);
this.addToPbxSourcesBuildPhase(file);
file.models = [];
var currentVersionName;
var modelFiles = fs.readdirSync(file.path);
for (var index in modelFiles) {
var modelFileName = modelFiles[index];
var modelFilePath = path.join(filePath, modelFileName);
if (modelFileName == '.xccurrentversion') {
currentVersionName = plist.readFileSync(modelFilePath)._XCCurrentVersionName;
continue;
}
var modelFile = new pbxFile(modelFilePath);
modelFile.fileRef = this.generateUuid();
this.addToPbxFileReferenceSection(modelFile);
file.models.push(modelFile);
if (currentVersionName && currentVersionName === modelFileName) {
file.currentModel = modelFile;
}
}
if (!file.currentModel) {
file.currentModel = file.models[0];
}
this.addToXcVersionGroupSection(file);
return file;
}