internal static void ImportSupportLibrares(string destFolder) { Directory.CreateDirectory(destFolder); foreach (var lib in LocateMLRemoteLibraries()) { //UnityDebug.Log(lib); #if UNITY_EDITOR_OSX var target = GetOSXTargetPath(destFolder, lib); if (target == null) { continue; } CheckIfFileCanBeCopiedAndThrow(lib, target); MacOSDependencyChecker.Migrate(lib, target); var dm = MacOSDependencyChecker.GetDependencies(target); var missing = new List <string>(); using (new WorkingDirectoryShift(Path.GetDirectoryName(target))) { foreach (var dep in dm.dependencies) { if (File.Exists(dep)) { continue; } else { missing.Add(dep); } } } foreach (var item in missing) { var dep_path = Path.GetFullPath(item); if (!File.Exists(dep_path)) { //UnityDebug.LogFormat("missing dep: {0} for {1}", dep_path, dm.file); Directory.CreateDirectory(Path.GetDirectoryName(dep_path)); var src = Path.Combine(macOSDependencyPath, Path.GetFileName(item)); //UnityDebug.LogFormat("searching for {0}: {1}", Path.GetFileName(item), src); if (File.Exists(src)) { File.Copy(src, dep_path); } } } #else var basename = Path.GetFileName(lib); var target = Path.Combine(destFolder, basename); if (target == null) { continue; // null indicates the file shouldn't be copied. } CheckIfFileCanBeCopiedAndThrow(lib, target); File.Copy(lib, target); #endif } AssetDatabase.Refresh(); }
internal static void ImportSupportLibrares(string destFolder) { Directory.CreateDirectory(destFolder); foreach (var lib in LocateMLRemoteLibraries()) { #if UNITY_EDITOR_OSX var target = GetOSXTargetPath(destFolder, lib); if (target == null) { continue; } CheckIfFileCanBeCopiedAndThrow(lib, target); if (SDKUtility.sdkVersion <= new Version("0.23.0")) { MacOSDependencyChecker.MigrateWithDependencies(lib, target); } else { MacOSDependencyChecker.Migrate(lib, target); } var dm = MacOSDependencyChecker.GetDependencies(target); var missing = new List <string>(); using (new WorkingDirectoryShift(Path.GetDirectoryName(target))) { foreach (var dep in dm.dependencies) { if (File.Exists(dep)) { continue; } else { missing.Add(dep); } } } foreach (var item in missing) { var dep_path = Path.GetFullPath(item); if (!File.Exists(dep_path)) { var dep_file = Path.GetFileName(item); if (TryFindDependencyOnSearchPath(dep_file, out var src)) { Directory.CreateDirectory(Path.GetDirectoryName(dep_path)); if (File.Exists(src)) { File.Copy(src, dep_path); } } } } #else var basename = Path.GetFileName(lib); var target = Path.Combine(destFolder, basename); if (target == null) { continue; // null indicates the file shouldn't be copied. } CheckIfFileCanBeCopiedAndThrow(lib, target); File.Copy(lib, target); #endif } AssetDatabase.Refresh(); }