mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 08:30:45 -05:00
Rename ShouldReaquire & check if bundle exists (!160)
I didn't keep in mind that 'ShouldReaquire' handles both the initial check for acquiring of a file and also the re-acquiring of it, I've renamed the method here to be more accurate in this behavior so that hopefully it prevents this from happening again in the future. Also fixes the issue of an exception being thrown when checking if the bundle exists or not. Thanks to MadByte for finding this issue Reviewed-on: SPT/Modules#160 Co-authored-by: Archangel <jesse@archangel.wtf> Co-committed-by: Archangel <jesse@archangel.wtf>
This commit is contained in:
parent
f235ee21b7
commit
939c85bc7c
@ -95,9 +95,12 @@ namespace SPT.Custom.Patches
|
|||||||
path = BundleManager.GetBundlePath(bundleInfo);
|
path = BundleManager.GetBundlePath(bundleInfo);
|
||||||
|
|
||||||
// only download when connected externally
|
// only download when connected externally
|
||||||
if (await BundleManager.ShouldReaquire(bundleInfo))
|
if (await BundleManager.ShouldAcquire(bundleInfo))
|
||||||
{
|
{
|
||||||
VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo));
|
if (VFS.Exists(BundleManager.GetBundleFilePath(bundleInfo)))
|
||||||
|
{
|
||||||
|
VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo));
|
||||||
|
}
|
||||||
|
|
||||||
await BundleManager.DownloadBundle(bundleInfo);
|
await BundleManager.DownloadBundle(bundleInfo);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,8 @@ namespace SPT.Custom.Utils
|
|||||||
await VFS.WriteFileAsync(filepath, data);
|
await VFS.WriteFileAsync(filepath, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<bool> ShouldReaquire(BundleItem bundle)
|
// Handles both the check for initially acquiring and also re-acquiring a file.
|
||||||
|
public static async Task<bool> ShouldAcquire(BundleItem bundle)
|
||||||
{
|
{
|
||||||
// read cache
|
// read cache
|
||||||
var filepath = GetBundleFilePath(bundle);
|
var filepath = GetBundleFilePath(bundle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user