Skip to content

Commit

Permalink
Update FileSystemCollector.cs
Browse files Browse the repository at this point in the history
Fix #445
  • Loading branch information
gfs committed May 18, 2020
1 parent fdd85d0 commit 21a3f3d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Lib/Collectors/FileSystemCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ public override void ExecuteInternal()

foreach (var root in roots)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var info = new FileInfo(root);
GetDiskFreeSpace(info.Directory.Root.FullName, out uint lpSectorsPerCluster, out uint lpBytesPerSector, out _, out _);
ClusterSizes[info.Directory.Root.FullName] = lpSectorsPerCluster * lpBytesPerSector;
}
Log.Information("{0} root {1}", Strings.Get("Scanning"), root);
var filePathEnumerable = DirectoryWalker.WalkDirectory(root);

Expand Down Expand Up @@ -396,6 +390,8 @@ private static long SizeOnDisk(string path)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
FileInfo info = new FileInfo(path);
GetDiskFreeSpace(info.FullName, out uint lpSectorsPerCluster, out uint lpBytesPerSector, out _, out _);

uint clusterSize = ClusterSizes[info.Directory.Root.FullName];
uint lowSize = GetCompressedFileSizeW(path, out uint highSize);
long size = (long)highSize << 32 | lowSize;
Expand Down

0 comments on commit 21a3f3d

Please sign in to comment.