public void ApplyMod(XCMod mod) { PBXGroup modGroup = this.GetGroup(mod.group); foreach (XCModFile libRef in mod.libs) { string completeLibPath; if (libRef.sourceTree.Equals("SDKROOT")) { completeLibPath = System.IO.Path.Combine("usr/lib", libRef.filePath); PBXGroup libraryGroup = GetGroup("Libraries"); this.AddFile(completeLibPath, libraryGroup, libRef.sourceTree, true, libRef.isWeak); } else { completeLibPath = System.IO.Path.Combine(mod.path, libRef.filePath); this.AddFile(completeLibPath, modGroup, libRef.sourceTree, true, libRef.isWeak); } } PBXGroup frameworkGroup = this.GetGroup("Frameworks"); foreach (string framework in mod.frameworks) { string[] filename = framework.Split(':'); bool isWeak = (filename.Length > 1) ? true : false; string completePath = System.IO.Path.Combine("System/Library/Frameworks", filename[0]); this.AddFile(completePath, frameworkGroup, "SDKROOT", true, isWeak); } foreach (string filePath in mod.files) { string absoluteFilePath = System.IO.Path.Combine(mod.path, filePath); this.AddFile(absoluteFilePath, modGroup); } foreach (string folderPath in mod.folders) { string absoluteFolderPath = System.IO.Path.Combine(mod.path, folderPath); absoluteFolderPath = System.IO.Path.GetFullPath(absoluteFolderPath).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); this.AddFolder(absoluteFolderPath, mod.path, modGroup, mod.excludes.ToArray(), false /*recursive*/); } foreach (string headerpath in mod.headerpaths) { string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, headerpath)); this.AddHeaderSearchPaths(absoluteHeaderPath); } foreach (string librarypath in mod.librarysearchpaths) { string absolutePath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, librarypath)); this.AddLibrarySearchPaths(absolutePath); } if (mod.frameworksearchpath != null) { foreach (string frameworksearchpath in mod.frameworksearchpath) { string absoluteHeaderPath = AddXcodeQuotes(System.IO.Path.Combine(mod.path, frameworksearchpath)); this.AddFrameworkSearchPaths(absoluteHeaderPath); } } this.Consolidate(); }
public void ApplyMod(string rootPath, string pbxmod) { XCMod mod = new XCMod(System.IO.Path.GetFullPath(rootPath), pbxmod); ApplyMod(mod); }