Skip to content

Commit

Permalink
Fix reading Volume/Drive name when using network shares
Browse files Browse the repository at this point in the history
Fixes #42
  • Loading branch information
UniqProject committed Feb 28, 2023
1 parent b16e277 commit 30bbf60
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions BDInfo/BDROM/IO/DirectoryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ public IFileInfo[] GetFiles(string searchPattern, SearchOption searchOption)

public string GetVolumeLabel()
{
var driveInfo = new DriveInfo(_impl.FullName);
return _impl.Root.FullName == _impl.FullName ? driveInfo.VolumeLabel : Name;
try
{
var driveInfo = new DriveInfo(_impl.FullName);
return _impl.Root.FullName == _impl.FullName ? driveInfo.VolumeLabel : Name;
}
catch (Exception)
{
return Name;
}

}

public static IDirectoryInfo FromDirectoryName(string path)
Expand Down

0 comments on commit 30bbf60

Please sign in to comment.