Skip to content

Commit

Permalink
测试
Browse files Browse the repository at this point in the history
  • Loading branch information
wuliaodexiaoluo authored Aug 19, 2024
1 parent bea46bd commit ac4c170
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Plain Craft Launcher 2/Modules/Base/ModBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,7 @@ Re:
If Not Directory.Exists(Path) Then Return 0
Dim DeletedCount As Integer = 0
Dim Temp As String()
Dim IsSymbolLink As Boolean = True
Temp = Directory.GetFiles(Path)
For Each FilePath As String In Temp
Dim RetriedFile As Boolean = False
Expand Down Expand Up @@ -1277,10 +1278,24 @@ RetryFile:
Dim RetriedDir As Boolean = False
RetryDir:
Try
If Path.Contains("resources") Then
Log("[Delete] 尝试删除 Resources")
' 如果包含 resources 并且 IsSymbolLink 是 True,则尝试调用 File.Delete 删除
' 如果前面是 False, AndAlso 后的条件即使为 True 也不会执行
If str.Contains("resources") AndAlso IsSymbolLink Then
' 符号链接比较特殊,所以单独开一个 Try 处理
Try
File.Delete(Path)
Catch ex As Exception
If Not RetriedDir Then
RetriedDir = True
Log(ex,$"删除符号链接失败,将在 0.3s 后重试({FilePath})")
Thread.sleep(300)
GoTo RetriedDir
Else If RetriedDir Then
IsSymbolLink = False
GoTo RetriedDir
Else If Not IsSymbolLink Then
Directory.Delete(Path, True)
End If
Directory.Delete(Path, True)
Catch ex As Exception
If Not RetriedDir Then
RetriedDir = True
Expand Down

0 comments on commit ac4c170

Please sign in to comment.