//Copies a directory and its contents into the XCode project recursively and adds it to the main target. protected void AddDirectoryRecursively(string sourceDir, string destDir, XcodeObject parentGroup) { DirectoryInfo sourceDirInfo = new DirectoryInfo(sourceDir); //Create files foreach(FileInfo file in sourceDirInfo.GetFiles()){ if(IsIgnored(file.Name)){ continue; } else{ AddFile(file, destDir, parentGroup); } } //Recurse foreach(DirectoryInfo subDir in sourceDirInfo.GetDirectories()){ if(IsIgnored(subDir.Name)){ // ... } else if(IsBundle(subDir.Name)){ AddBundle(subDir, destDir, parentGroup); } else if(IsFrameworkDirectory(subDir.Name)){ AddFrameworkDirectory(subDir, destDir, parentGroup); } else{ XcodeObject groupObj = null; DirectoryInfo destSubDir = new DirectoryInfo(Path.Combine(destDir, subDir.Name)); //Set up the dest directory if(!destSubDir.Exists || parentGroup.GetGroup(destSubDir.Name) == null){ destSubDir.Create(); //Make containing Xcode group groupObj = new XcodeObject(UniqueIds); groupObj.literals["isa"] = "PBXGroup"; groupObj.literals["sourceTree"] = "\"<group>\""; groupObj.literals["children"] = "()"; groupObj.literals["path"] = "\""+destSubDir.Name+"\""; string groupObjId = GetNewUniqueId(groupObj); parentGroup.AddLiteralListElement("children", groupObjId); } else{ groupObj = parentGroup.GetGroup(destSubDir.Name); } AddDirectoryRecursively(subDir.FullName, Path.Combine(destDir, subDir.Name), groupObj); } } }