From 6e3bdfd286cd7e0ce15d8d649b2bd50c626ef6ff Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 2 May 2023 15:30:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=80=E5=8D=95=E5=A4=84=E7=90=86?= =?UTF-8?q?=E4=B8=8B=E8=BF=9E=E7=BB=AD=E6=9B=B4=E6=96=B0=E5=90=8E.old?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=A0=E9=99=A4=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index f5b2f88496..ca016e0ba8 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -274,7 +274,14 @@ namespace MaaWpfGui.ViewModels.UI foreach (var oldFile in Directory.GetFiles(curDir, "*.old")) { - File.Delete(oldFile); + try + { + File.Delete(oldFile); + } + catch (Exception) + { + File.Move(oldFile, oldFile + ".old"); + } } // 操作完了,把解压的文件删了