[fix] 修复2019版本MonoBleedingEdge的子目录中包含了过长路径的文件导致Installer复制文件出错的问题

[change] StripAOTDllCommand失败时抛出异常而不是打印错误日志
main
walon 2023-04-30 01:35:25 +08:00
parent 1045538b40
commit 2894701063
2 changed files with 17 additions and 3 deletions

View File

@ -113,8 +113,7 @@ namespace HybridCLR.Editor.Commands
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
{
Debug.LogError("GenerateStripedAOTDlls 失败");
return;
throw new Exception("GenerateStripedAOTDlls 失败");
}
Debug.Log($"GenerateStripedAOTDlls target:{target} group:{group} path:{outputPath}");
}

View File

@ -88,6 +88,21 @@ namespace HybridCLR.Editor.Installer
Directory.CreateDirectory(dir);
}
private static void CopyWithCheckLongFile(string srcFile, string dstFile)
{
if (srcFile.Length > 255)
{
UnityEngine.Debug.LogError($"srcFile:{srcFile} path is too long. copy ignore!");
return;
}
if (dstFile.Length > 255)
{
UnityEngine.Debug.LogError($"dstFile:{dstFile} path is too long. copy ignore!");
return;
}
File.Copy(srcFile, dstFile);
}
public static void CopyDir(string src, string dst, bool log = false)
{
if (log)
@ -98,7 +113,7 @@ namespace HybridCLR.Editor.Installer
Directory.CreateDirectory(dst);
foreach(var file in Directory.GetFiles(src))
{
File.Copy(file, $"{dst}/{Path.GetFileName(file)}");
CopyWithCheckLongFile(file, $"{dst}/{Path.GetFileName(file)}");
}
foreach(var subDir in Directory.GetDirectories(src))
{