Drive label should not contain bad chars

This commit is contained in:
Matt Nadareski
2020-08-14 12:59:23 -07:00
parent 6cbcebd661
commit 4f732557b9

View File

@@ -30,17 +30,19 @@ namespace DICUI.Utilities
{
get
{
string volumeLabel = Template.DiscNotDetected;
if (DriveInfo.IsReady)
{
if (string.IsNullOrWhiteSpace(DriveInfo.VolumeLabel))
return "track";
volumeLabel = "track";
else
return DriveInfo.VolumeLabel;
}
else
{
return Template.DiscNotDetected;
volumeLabel = DriveInfo.VolumeLabel;
}
foreach (char c in Path.GetInvalidFileNameChars())
volumeLabel = volumeLabel.Replace(c, '_');
return volumeLabel;
}
}