[fix] fix the bug that BashUtil.CopyDir calls UnityEditor.FileUtil.CopyFileOrDirectory failed when parent directory of dst does not exist.

main
walon 2025-08-26 21:17:03 +08:00
parent d505624c78
commit 814572e1a1
1 changed files with 9 additions and 1 deletions

View File

@ -108,7 +108,15 @@ namespace HybridCLR.Editor.Installer
{ {
UnityEngine.Debug.Log($"[BashUtil] CopyDir {src} => {dst}"); UnityEngine.Debug.Log($"[BashUtil] CopyDir {src} => {dst}");
} }
RemoveDir(dst); if (Directory.Exists(dst))
{
RemoveDir(dst);
}
else
{
string parentDir = Path.GetDirectoryName(Path.GetFullPath(dst));
Directory.CreateDirectory(parentDir);
}
UnityEditor.FileUtil.CopyFileOrDirectory(src, dst); UnityEditor.FileUtil.CopyFileOrDirectory(src, dst);
} }