Browse Source

Merge pull request #2995 from AvaloniaUI/fix-managed-dialog-enumeration

Fix managed dialog enumeration and volume label on Windows.
danwalmsley 6 years ago
parent
commit
b58c75fdac
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Windows/Avalonia.Win32/WindowsMountedVolumeInfoListener.cs

+ 3 - 1
src/Windows/Avalonia.Win32/WindowsMountedVolumeInfoListener.cs

@@ -32,9 +32,11 @@ namespace Avalonia.Win32
             var allDrives = DriveInfo.GetDrives();
 
             var mountVolInfos = allDrives
+                                .Where(p => p.IsReady)
                                 .Select(p => new MountedVolumeInfo()
                                 {
-                                    VolumeLabel = p.VolumeLabel,
+                                    VolumeLabel = string.IsNullOrEmpty(p.VolumeLabel.Trim()) ? p.RootDirectory.FullName 
+                                                                                             : $"{p.VolumeLabel} ({p.Name})",
                                     VolumePath = p.RootDirectory.FullName,
                                     VolumeSizeBytes = (ulong)p.TotalSize
                                 })