static PBXFileReference CommonCreate(string uid, string path, string sourceTree, PBXGroup group) { NullCheck(uid, path, group); PBXProjDictionary emptyDic = new PBXProjDictionary(); //isa emptyDic.Add(isaKey, PBXTypes.PBXFileReference.ToString()); //path //TODO check that path will never have quotes or be a literal when entered //string unquotedPath = path.FromLiteral(); string unquotedPath = path; emptyDic.Add(PATH_KEY, unquotedPath.ToLiteralIfRequired()); //file type var fileType = PBXFileTypeHelper.FileTypeFromFileName(unquotedPath); if (sourceTree == SourceTreeLocation.BUILT_PRODUCTS_DIR) { emptyDic.Add(EXPLICIT_FILE_TYPE_KEY, fileType.GetXcodeDataValue()); emptyDic.Add(INCLUDE_IN_INDEX_KEY, 0); } else { emptyDic.Add(LAST_KNOWN_FILE_TYPE_KEY, fileType.GetXcodeDataValue()); } //source tree emptyDic.Add(SOURCE_TREE_KEY, sourceTree); //filename var fileName = System.IO.Path.GetFileName(unquotedPath); if (fileName != unquotedPath) { emptyDic.Add(NAME_KEY, fileName.ToLiteralIfRequired()); } //TODO ignore file encoding for now var fileRef = new PBXFileReference(uid, emptyDic); fileRef.ParentGroup = group; return(fileRef); }
public static PBXFileReference CreateRelativeToDeveloperDirectory(string uid, string path, PBXGroup group) { var fileRef = CommonCreate(uid, path, SourceTreeLocation.DEVELOPER_DIR, group); return(fileRef); }
public static PBXFileReference CreateBuildTarget(string uid, string fileName, PBXGroup group) { var fileRef = CommonCreate(uid, fileName, SourceTreeLocation.BUILT_PRODUCTS_DIR, group); return(fileRef); }
public static PBXFileReference CreateWithAbsolutePath(string uid, string path, PBXGroup group) { var fileRef = CommonCreate(uid, path, SourceTreeLocation.ABSOLUTE, group); return(fileRef); }
public static PBXFileReference CreateRelativeToGroup(string uid, string fileName, PBXGroup group) { var fileRef = CommonCreate(uid, fileName, SourceTreeLocation.GROUP, group); return(fileRef); }
public static PBXFileReference CreateRelativeToSourceRoot(string uid, string path, PBXGroup group) { var fileRef = CommonCreate(uid, path, SourceTreeLocation.SOURCE_ROOT, group); return(fileRef); }