Don't attempt to compress files smaller than the cluster size.

This commit is contained in:
Unnoen 2020-09-17 22:49:41 +10:00
parent d828b5b0ff
commit 4b837d83bb
No known key found for this signature in database
GPG Key ID: F370906A9D954C50

View File

@ -60,11 +60,17 @@ namespace Wabbajack.Common
public static async Task CompactFolder(this AbsolutePath folder, WorkQueue queue, Algorithm algorithm)
{
var driveInfo = folder.DriveInfo().DiskSpaceInfo;
var clusterSize = driveInfo.SectorsPerCluster * driveInfo.BytesPerSector;
await folder.EnumerateFiles(true)
.PMap(queue, async path =>
{
Utils.Status($"Compacting {path.FileName}");
await path.Compact(algorithm);
if (path.Size > clusterSize)
{
Utils.Status($"Compacting {path.FileName}");
await path.Compact(algorithm);
}
});
}
}