diff --git a/Runtime/LLMBuilder.cs b/Runtime/LLMBuilder.cs index 542520f9..5b2fc278 100644 --- a/Runtime/LLMBuilder.cs +++ b/Runtime/LLMBuilder.cs @@ -17,12 +17,12 @@ private static void InitializeOnLoad() { Reset(); } - - public static void CopyPath(string source, string target) + + public static void HandleActionFileRecursive(string source, string target, ActionCallback actionCallback) { if (File.Exists(source)) { - File.Copy(source, target, true); + actionCallback(source, target); } else if (Directory.Exists(source)) { @@ -32,14 +32,24 @@ public static void CopyPath(string source, string target) filesAndDirs.AddRange(Directory.GetDirectories(source)); foreach (string path in filesAndDirs) { - CopyPath(path, Path.Combine(target, Path.GetFileName(path))); + HandleActionFileRecursive(path, Path.Combine(target, Path.GetFileName(path)), actionCallback); } } } + public static void CopyWithOverwrite(string source, string target) + { + File.Copy(source, target, true); + } + + public static void CopyPath(string source, string target) + { + HandleActionFileRecursive(source, target, CopyWithOverwrite); + } + public static void MovePath(string source, string target) { - CopyPath(source, target); + HandleActionFileRecursive(source, target, File.Move); DeletePath(source); } diff --git a/Runtime/LLMLib.cs b/Runtime/LLMLib.cs index bb7417c7..0732846a 100644 --- a/Runtime/LLMLib.cs +++ b/Runtime/LLMLib.cs @@ -303,6 +303,7 @@ static LLMLib() has_avx = LibraryLoader.GetSymbolDelegate(archCheckerHandle, "has_avx")(); has_avx2 = LibraryLoader.GetSymbolDelegate(archCheckerHandle, "has_avx2")(); has_avx512 = LibraryLoader.GetSymbolDelegate(archCheckerHandle, "has_avx512")(); + LibraryLoader.FreeLibrary(archCheckerHandle); } catch (Exception e) {