/// <summary> /// 重置Plugins/Android. /// </summary> private static void ResetPluginsAndroid() { var fromDir = $"{Application.dataPath}/../AndroidPlatform/Default"; if (false == UtilsTools.CheckAndCreateDir(fromDir)) { return; } var toDir = $"{Application.dataPath}/Plugins/Android"; if (false == UtilsTools.CheckAndCreateDir(toDir)) { return; } // 拷贝文件 var dirInfo = new DirectoryInfo(fromDir); var allFiles = dirInfo.GetFiles(); if (1 <= allFiles.Length) { foreach (var file in allFiles) { if (file.Name.EndsWith(".meta")) { continue; } // 拷贝文件 var copyToFile = $"{toDir}/{file.Name}"; Loger.BuildLog($"Copy File : {file.FullName} -> {copyToFile}"); File.Copy(file.FullName, copyToFile, true); } } // 检索子文件夹 var subDirs = dirInfo.GetDirectories(); if (1 > subDirs.Length) { return; } foreach (var subDir in subDirs) { var subFromDir = $"{fromDir}/{subDir.Name}"; // 拷贝 UtilsTools.CopyDirectory(subFromDir, toDir); } }
/// <summary> /// 拷贝库资源文件. /// </summary> public void CopyResources() { var copyFromDir = GetAndroidCopyFromDir(); var copyToDir = GetAndroidCopyToDir(); // Libs var files = Directory.GetFiles(copyFromDir); foreach (var file in files) { if (file.EndsWith("AndroidManifest.xml")) { continue; } if (file.EndsWith(".meta")) { continue; } var lastIndex = file.LastIndexOf("/", StringComparison.Ordinal); var fileName = file.Substring(lastIndex + 1); if (string.IsNullOrEmpty(fileName)) { continue; } var copyToFile = $"{copyToDir}/{fileName}"; if (File.Exists(copyToFile)) { File.Delete(copyToFile); } this.Info("CopyResources()::Copy Libs : {0} -> {1}", file, copyToFile); File.Copy(file, copyToFile); } // res var copyRes = $"{copyFromDir}/res"; if (Directory.Exists(copyRes)) { UtilsTools.CopyDirectory(copyRes, copyToDir); } }