mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix tests and implement hard link support
This commit is contained in:
parent
314c77a830
commit
287eebdd3d
@ -349,6 +349,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public bool HardLinkTo(AbsolutePath destination)
|
||||
{
|
||||
Utils.Log($"Hard Linking {_path} to {destination}");
|
||||
return CreateHardLink((string)destination, (string)this, IntPtr.Zero);
|
||||
}
|
||||
|
||||
@ -356,7 +357,10 @@ namespace Wabbajack.Common
|
||||
|
||||
public async ValueTask HardLinkIfOversize(AbsolutePath destination)
|
||||
{
|
||||
if (Root == destination.Root || Size >= HARDLINK_THRESHOLD)
|
||||
if (!destination.Parent.Exists)
|
||||
destination.Parent.CreateDirectory();
|
||||
|
||||
if (Root == destination.Root && Size >= HARDLINK_THRESHOLD)
|
||||
{
|
||||
if (HardLinkTo(destination))
|
||||
return;
|
||||
@ -432,13 +436,6 @@ namespace Wabbajack.Common
|
||||
await file.CopyToAsync(dest);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CopyOrLinkIfOverSizeAsync(AbsolutePath newFile)
|
||||
{
|
||||
if (newFile.Parent != default)
|
||||
newFile.Parent.CreateDirectory();
|
||||
await CopyToAsync(newFile);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(Utils.RelativePathConverter))]
|
||||
|
@ -37,7 +37,7 @@ namespace Wabbajack.Lib.Tasks
|
||||
}
|
||||
|
||||
Utils.Log($"Copying/Linking {relPath}");
|
||||
await file.CopyOrLinkIfOverSizeAsync(newFile);
|
||||
await file.HardLinkIfOversize(newFile);
|
||||
}
|
||||
|
||||
Utils.Log("Remapping INI");
|
||||
|
Loading…
Reference in New Issue
Block a user