diff --git a/src/MeoAsstGui/Bootstrapper.cs b/src/MeoAsstGui/Bootstrapper.cs index 5354121c31..cd932796c8 100644 --- a/src/MeoAsstGui/Bootstrapper.cs +++ b/src/MeoAsstGui/Bootstrapper.cs @@ -78,6 +78,34 @@ namespace MeoAsstGui } } + // TODO: Delete this + // 由于 zzyyyl 的失误,v4.6.5-beta.3 之后的版本会在更新时删除 Paddle,在发正式版后将下面的块删掉 + // 恢复被删除的 Paddle + { + string resourceDir = Directory.GetCurrentDirectory() + "\\resource"; + string oldResourceDir = Directory.GetCurrentDirectory() + "\\resource.old"; + + var paddleResourcePaths = new[] + { + "\\PaddleOCR", + "\\PaddleCharOCR", + "\\global\\txwy\\resource\\PaddleOCR", + "\\global\\YoStarEN\\resource\\PaddleOCR", + "\\global\\YoStarJP\\resource\\PaddleOCR", + "\\global\\YoStarKR\\resource\\PaddleOCR", + }; + + foreach (var path in paddleResourcePaths) + { + string paddleDir = resourceDir + path; + string oldPaddleDir = oldResourceDir + path; + if (Directory.Exists(oldPaddleDir) && !Directory.Exists(paddleDir)) + { + VersionUpdateViewModel.CopyFilesRecursively(oldPaddleDir, paddleDir); + } + } + } + base.OnStart(); ViewStatusStorage.Load(); Localization.Load(); diff --git a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs index 40613fef9c..2a9f925ab1 100644 --- a/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs +++ b/src/MeoAsstGui/ViewModels/VersionUpdateViewModel.cs @@ -243,7 +243,7 @@ namespace MeoAsstGui { string paddleDir = resourceDir + path; string oldPaddleDir = oldResourceDir + path; - if (Directory.Exists(paddleDir)) + if (Directory.Exists(oldPaddleDir)) { CopyFilesRecursively(oldPaddleDir, paddleDir); } @@ -891,7 +891,7 @@ namespace MeoAsstGui /// /// 源文件夹 /// 目标文件夹 - private static void CopyFilesRecursively(string sourcePath, string targetPath) + public static void CopyFilesRecursively(string sourcePath, string targetPath) { Directory.CreateDirectory(targetPath);