public static List <string> PackZips(string outpath) { List <string> finalZipFiles = new List <string>(); var allDirs = AssetDatabase.GetAllAssetPaths().Where(path => (Directory.Exists(path))); List <string> zipdirs = new List <string> (); foreach (var k in allDirs) { UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(k, typeof(UnityEngine.Object)); if (QAssetBundleTool.HasPTABLabel(obj, QAssetBundleTool.LABEL_ZIP)) { zipdirs.Add(k); } } foreach (var path in zipdirs) { string tempDir = "temp_pt"; if (Directory.Exists(tempDir)) { Directory.Delete(tempDir, true); } Directory.CreateDirectory(tempDir); AssetDatabase.Refresh(); DirectoryCopy(path, tempDir, true); //FileUtil.CopyFileOrDirectory(path,tempDir); cleanMeta(tempDir); PackFiles(outpath + "/" + Path.GetFileName(path) + ".zip", tempDir); Directory.Delete(tempDir, true); finalZipFiles.Add(outpath + "/" + Path.GetFileName(path) + ".zip"); } return(finalZipFiles); }
public static List <string> PackPTFiles(string outpath) { List <string> finalZipFiles = new List <string>(); var allFiles = AssetDatabase.GetAllAssetPaths().Where(path => (File.Exists(path))); List <string> files = new List <string> (); foreach (var k in allFiles) { UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(k, typeof(UnityEngine.Object)); if (QAssetBundleTool.HasPTABLabel(obj, QAssetBundleTool.LABEL_FILE)) { files.Add(k); FileUtil.ReplaceFile(k, outpath + "/" + Path.GetFileName(k)); finalZipFiles.Add(outpath + "/" + Path.GetFileName(k)); } } return(finalZipFiles); }