Do not crash when calling on network drives e.g. "\\vmware\shared"

This commit is contained in:
Paddy Xu
2018-08-05 23:27:05 +03:00
parent 6d3f4c4821
commit cdc5f0f2f4

View File

@@ -27,10 +27,17 @@ namespace QuickLook.Plugin.InfoPanel
{
totalSpace = totalFreeSpace = 0L;
var root = new DriveInfo(Path.GetPathRoot(path));
try
{
var root = new DriveInfo(Path.GetPathRoot(path));
totalSpace = root.TotalSize;
totalFreeSpace = root.AvailableFreeSpace;
totalSpace = root.TotalSize;
totalFreeSpace = root.AvailableFreeSpace;
}
catch (Exception)
{
// ignored
}
}
public static void CountFolder(string root, ref bool stop, out long totalDirs, out long totalFiles,