private void CopyFile(string inPath, string outPath, Action finish) { if (!File.Exists(outPath.Replace("file://", null))) { CopyFiles.Copy(inPath, outPath, null, (uwr) => { if (!string.IsNullOrEmpty(uwr.error)) { Debug.LogWarning(GetType() + "/CopyFile()/ copy error! " + uwr.error); } else { if (finish != null) { finish(); } } }); } else { if (finish != null) { finish(); } } }
private void StartCopyLuaFiles() { string destDir = BuildDefaultPath.GetBuildLuaPath; string[] sourcesDirs = { BuildDefaultPath.GetLuaDataPath, BuildDefaultPath.GetToLuaDataPath, }; CopyFiles.Copy(destDir, sourcesDirs); }
/// <summary> /// 打包文件夹 /// </summary> /// <param name="fileDir">文件目录</param> /// <param name="folderName">文件名称</param> /// <param name="inPathArr">输入文件路径集合</param> /// <param name="outPath">输出文件路径集合</param> /// <param name="progress">打包进度</param> private static void PackFolder(string fileDir, string folderName, string[] inPathArr, string outPath, Action <float> progress = null) { string temp = AssetDefine.UpkTempCompressionPath + "/" + folderName + "/" + fileDir; if (Directory.Exists(temp)) { Directory.Delete(temp, true); } Directory.CreateDirectory(temp); for (int i = 0; i < inPathArr.Length; i++) { string pStrFilePath = inPathArr[i]; string[] inpathArr = pStrFilePath.Split('/'); string pPerFilePath = temp + "/" + inpathArr[inpathArr.Length - 1]; CopyFiles.Copy(pStrFilePath, pPerFilePath); } UpkUtil.PackFolder(temp, outPath, progress); }
public CopyAssets(string outputPath) { if (Directory.Exists(Application.streamingAssetsPath)) { Directory.Delete(Application.streamingAssetsPath, true); } Directory.CreateDirectory(outputPath); string source = Path.Combine(ResUtility.AssetBundlesOutputPath, ResUtility.GetPlatformPath).Replace('\\', '/'); if (!Directory.Exists(source)) { Debug.LogError("No assetBundle output folder, try to build the assetBundles first."); return; } string destination = Path.Combine(outputPath, ResUtility.GetPlatformPath).Replace('\\', '/'); string[] sources = { source }; CopyFiles.Copy(destination, sources); }