Skip to content

Commit 083dc6f

Browse files
authored
Drives: Fixed drives loading when no letter is assigned to a partition (#1168)
1 parent 5d4caeb commit 083dc6f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Files/Filesystem/Drives.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,19 @@ private async Task GetDrives(IList<DriveItem> list)
187187
var drives = DriveInfo.GetDrives().ToList();
188188

189189
var remDevices = await DeviceInformation.FindAllAsync(StorageDevice.GetDeviceSelector());
190-
var supportedDevicesNames = remDevices.Select(x => StorageDevice.FromId(x.Id).Name);
190+
List<string> supportedDevicesNames = new List<string>();
191+
foreach (var item in remDevices)
192+
{
193+
try
194+
{
195+
supportedDevicesNames.Add(StorageDevice.FromId(item.Id).Name);
196+
}
197+
catch (Exception e)
198+
{
199+
Logger.Warn("Can't get storage device name: " + e.Message + ", skipping...");
200+
}
201+
}
202+
191203
foreach (DriveInfo driveInfo in drives.ToList())
192204
{
193205
if (!supportedDevicesNames.Contains(driveInfo.Name) && driveInfo.DriveType == System.IO.DriveType.Removable)

0 commit comments

Comments
 (0)