public static bool BuildNativeAB(string platformName) { System.GC.Collect(); System.GC.Collect(); ReadFile(); ParseAllDir(); RootFolderNmae(); ParseTheVersion(); FilesFilter(); string nativePath = string.Format("{0}/{1}", ABHelper.AppNativeVersionPath, ABHelper.NativeFileName); // 删 List <string> nativeList = ABHelper.ReadNativeFileByPath(nativePath); foreach (var v in nativeList) { string p = string.Format("{0}/{1}", ABHelper.AppNativeVersionPath, v); if (File.Exists(p)) { File.Delete(p); } } if (File.Exists(nativePath)) { File.Delete(nativePath); } // 增 string path = string.Format("{0}/../../../assetBundle/{1}/{2}/{3}.{4}/HotterZip/{5}-{6}/", Application.dataPath, TheRootFolderName, platformName, TheVersionNum[0], TheVersionNum[1], -1, TheVersionNum[2]); if (!Directory.Exists(path)) { Debug.LogError("路径不存在:" + path); return(false); } if (!Directory.Exists(ABHelper.AppNativeVersionPath)) { Directory.CreateDirectory(ABHelper.AppNativeVersionPath); } Dictionary <string, string> versionInfo = ReadVersionFileByPath(path + TheVersionNum[2] + "/version.ini"); List <string> files = ABHelper.GetAllFilesPathInDir(path); nativeList.Clear(); string name1 = ""; string path1 = ""; string path2 = ""; foreach (var v in files) { // 过滤 ui,lua和audio文件 path1 = v.Replace("\\", "/"); name1 = ABHelper.GetFileName(path1); if (versionInfo.ContainsKey(name1)) { if (!CheckRemoveDir(versionInfo[name1])) { continue; } } path2 = ABHelper.AppNativeVersionPath + "/" + name1; File.Copy(path1, path2, true); if (!v.EndsWith("version.ini")) { nativeList.Add(name1); } } // version.ini 放置尾包!! nativeList.Add("version.ini"); // 生成列表文件 ABHelper.WriteNativeFile(nativePath, nativeList); AssetDatabase.Refresh(); System.GC.Collect(); Debug.Log("streamingAssets文件生成成功!!文件源路径:" + path); return(true); }