private string AddFileImpl(string path, string projectPath, PBXSourceTree tree, bool isFolderReference) { PBXFileReferenceData data; path = PBXPath.FixSlashes(path); projectPath = PBXPath.FixSlashes(projectPath); if (!isFolderReference && (Path.GetExtension(path) != Path.GetExtension(projectPath))) { throw new Exception("Project and real path extensions do not match"); } string str = this.FindFileGuidByProjectPath(projectPath); if (str == null) { str = this.FindFileGuidByRealPath(path); } if (str != null) { return(str); } if (isFolderReference) { data = PBXFileReferenceData.CreateFromFolderReference(path, PBXPath.GetFilename(projectPath), tree); } else { data = PBXFileReferenceData.CreateFromFile(path, PBXPath.GetFilename(projectPath), tree); } PBXGroupData parent = this.CreateSourceGroup(PBXPath.GetDirectory(projectPath)); parent.children.AddGUID(data.guid); this.FileRefsAdd(path, projectPath, parent, data); return(data.guid); }
// The same file can be referred to by more than one project path. private string AddFileImpl(string path, string projectPath, PBXSourceTree tree, bool isFolderReference) { path = PBXPath.FixSlashes(path); projectPath = PBXPath.FixSlashes(projectPath); if (!isFolderReference && Path.GetExtension(path) != Path.GetExtension(projectPath)) { throw new Exception("Project and real path extensions do not match"); } string guid = FindFileGuidByProjectPath(projectPath); if (guid == null) { guid = FindFileGuidByRealPath(path); } if (guid == null) { PBXFileReferenceData fileRef; if (isFolderReference) { fileRef = PBXFileReferenceData.CreateFromFolderReference(path, PBXPath.GetFilename(projectPath), tree); } else { fileRef = PBXFileReferenceData.CreateFromFile(path, PBXPath.GetFilename(projectPath), tree); } PBXGroupData parent = CreateSourceGroup(PBXPath.GetDirectory(projectPath)); parent.children.AddGUID(fileRef.guid); FileRefsAdd(path, projectPath, parent, fileRef); guid = fileRef.guid; } return(guid); }