From 12969d32b51c3e141eefeead23b6ef7a63adb34e Mon Sep 17 00:00:00 2001 From: xiewen Date: Wed, 30 Jul 2025 13:54:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8UnityEditor.FileUtil.CopyFile?= =?UTF-8?q?OrDirectory=E4=BB=A3=E6=9B=BFSystem.IO.File.Copy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Installer/BashUtil.cs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Editor/Installer/BashUtil.cs b/Editor/Installer/BashUtil.cs index 90e4259..7b50b98 100644 --- a/Editor/Installer/BashUtil.cs +++ b/Editor/Installer/BashUtil.cs @@ -102,26 +102,6 @@ namespace HybridCLR.Editor.Installer } Directory.CreateDirectory(dir); } - - private static void CopyWithCheckLongFile(string srcFile, string dstFile) - { - var maxPathLength = 255; -#if UNITY_EDITOR_OSX - maxPathLength = 1024; -#endif - if (srcFile.Length > maxPathLength) - { - UnityEngine.Debug.LogError($"srcFile:{srcFile} path is too long. skip copy!"); - return; - } - if (dstFile.Length > maxPathLength) - { - UnityEngine.Debug.LogError($"dstFile:{dstFile} path is too long. skip copy!"); - return; - } - File.Copy(srcFile, dstFile); - } - public static void CopyDir(string src, string dst, bool log = false) { if (log) @@ -132,7 +112,7 @@ namespace HybridCLR.Editor.Installer Directory.CreateDirectory(dst); foreach(var file in Directory.GetFiles(src)) { - CopyWithCheckLongFile(file, $"{dst}/{Path.GetFileName(file)}"); + UnityEditor.FileUtil.CopyFileOrDirectory(file, $"{dst}/{Path.GetFileName(file)}"); } foreach(var subDir in Directory.GetDirectories(src)) {