mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #1094 from Unnoen/reduce-compress-work
Don't attempt to compress files smaller than the disk cluster size.
This commit is contained in:
commit
30b85bb442
@ -1,4 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Wabbajack.Common.IO;
|
using Wabbajack.Common.IO;
|
||||||
|
|
||||||
namespace Wabbajack.Common
|
namespace Wabbajack.Common
|
||||||
@ -60,7 +61,12 @@ namespace Wabbajack.Common
|
|||||||
|
|
||||||
public static async Task CompactFolder(this AbsolutePath folder, WorkQueue queue, Algorithm algorithm)
|
public static async Task CompactFolder(this AbsolutePath folder, WorkQueue queue, Algorithm algorithm)
|
||||||
{
|
{
|
||||||
await folder.EnumerateFiles(true)
|
var driveInfo = folder.DriveInfo().DiskSpaceInfo;
|
||||||
|
var clusterSize = driveInfo.SectorsPerCluster * driveInfo.BytesPerSector;
|
||||||
|
|
||||||
|
await folder
|
||||||
|
.EnumerateFiles(true)
|
||||||
|
.Where(f => f.Size > clusterSize)
|
||||||
.PMap(queue, async path =>
|
.PMap(queue, async path =>
|
||||||
{
|
{
|
||||||
Utils.Status($"Compacting {path.FileName}");
|
Utils.Status($"Compacting {path.FileName}");
|
||||||
|
Loading…
Reference in New Issue
Block a user