[change] BashUtil::CopyDir replaces CopyWithCheckLongFile with CopyUnityEditor.FileUtil.CopyFileOrDirectory
parent
73654e76d2
commit
b5944ea834
|
|
@ -102,26 +102,6 @@ namespace HybridCLR.Editor.Installer
|
||||||
}
|
}
|
||||||
Directory.CreateDirectory(dir);
|
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)
|
public static void CopyDir(string src, string dst, bool log = false)
|
||||||
{
|
{
|
||||||
if (log)
|
if (log)
|
||||||
|
|
@ -129,15 +109,8 @@ namespace HybridCLR.Editor.Installer
|
||||||
UnityEngine.Debug.Log($"[BashUtil] CopyDir {src} => {dst}");
|
UnityEngine.Debug.Log($"[BashUtil] CopyDir {src} => {dst}");
|
||||||
}
|
}
|
||||||
RemoveDir(dst);
|
RemoveDir(dst);
|
||||||
Directory.CreateDirectory(dst);
|
|
||||||
foreach(var file in Directory.GetFiles(src))
|
UnityEditor.FileUtil.CopyFileOrDirectory(src, dst);
|
||||||
{
|
|
||||||
CopyWithCheckLongFile(file, $"{dst}/{Path.GetFileName(file)}");
|
|
||||||
}
|
|
||||||
foreach(var subDir in Directory.GetDirectories(src))
|
|
||||||
{
|
|
||||||
CopyDir(subDir, $"{dst}/{Path.GetFileName(subDir)}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue