From 49c242e7bc0f392f35d16970866f47ed22508dd7 Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 25 Oct 2022 19:07:48 +0800 Subject: [PATCH] Update AssetBundleBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检测输出目录文件路径过长导致的异常。 --- .../BuildTasks/TaskCreatePatchManifest.cs | 13 +++++++++---- .../BuildTasks/TaskVerifyBuildResult.cs | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs index 5bba327..6866388 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs @@ -72,17 +72,22 @@ namespace YooAsset.Editor /// private List GetAllPatchBundle(BuildContext context) { - var buildParameters = context.GetContextObject(); + var buildParametersContext = context.GetContextObject(); var buildMapContext = context.GetContextObject(); var encryptionContext = context.GetContextObject(); List result = new List(1000); foreach (var bundleInfo in buildMapContext.BundleInfos) { + // NOTE:检测路径长度不要超过260字符。 + string filePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/{bundleInfo.BundleName}"; + if(filePath.Length >= 260) + throw new Exception($"The output bundle name is too long {filePath.Length} chars : {filePath}"); + var bundleName = bundleInfo.BundleName; - string fileHash = GetBundleFileHash(bundleInfo, buildParameters); - string fileCRC = GetBundleFileCRC(bundleInfo, buildParameters); - long fileSize = GetBundleFileSize(bundleInfo, buildParameters); + string fileHash = GetBundleFileHash(bundleInfo, buildParametersContext); + string fileCRC = GetBundleFileCRC(bundleInfo, buildParametersContext); + long fileSize = GetBundleFileSize(bundleInfo, buildParametersContext); string[] tags = buildMapContext.GetBundleTags(bundleName); bool isEncrypted = encryptionContext.IsEncryptFile(bundleName); bool isRawFile = bundleInfo.IsRawFile; diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskVerifyBuildResult.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskVerifyBuildResult.cs index 1623942..52dd554 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskVerifyBuildResult.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskVerifyBuildResult.cs @@ -62,6 +62,7 @@ namespace YooAsset.Editor } // 4. 验证Asset + /* bool isPass = true; var buildMode = buildParametersContext.Parameters.BuildMode; if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild) @@ -98,6 +99,7 @@ namespace YooAsset.Editor throw new Exception("构建结果验证没有通过,请参考警告日志!"); } } + */ BuildRunner.Log("构建结果验证成功!"); }