Sfoglia il codice sorgente

:bug: 空文件夹造成选中判断错误

youzi-2333 2 anni fa
parent
commit
6808620083

+ 2 - 1
Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml.vb

@@ -158,12 +158,13 @@
         End If
         If Directory.Exists(TargetPath) Then
             Dim di As New DirectoryInfo(TargetPath)
-            If (Not AllowEmpty) AndAlso di.GetDirectories.Length + di.GetFiles.Length = 0 Then Return 0
+            If di.GetDirectories.Length + di.GetFiles.Length = 0 Then Return If(AllowEmpty, 2, 0)
             '如果有一个文件不在列表,则 hasFalse = True
             Dim hasFalse As Boolean = False
             '如果有一个文件在列表,则 hasTrue = True
             Dim hasTrue As Boolean = False
             For Each d In Directory.EnumerateDirectories(TargetPath)
+                If Directory.EnumerateFileSystemEntries(d).Count = 0 Then Continue For
                 Select Case IsSelected(d, True)
                     Case 0
                         hasFalse = True