From e5f5241879d3f1d128a425cd134ad67fcc8d2049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Mon, 12 Aug 2024 20:18:03 +0800 Subject: [PATCH] fix #311 --- .../Operation/DCFSDownloadFileOperation.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs index e5bf7d2..1dde7aa 100644 --- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs +++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSDownloadFileOperation.cs @@ -250,17 +250,17 @@ namespace YooAsset if (File.Exists(_tempFilePath)) { FileInfo fileInfo = new FileInfo(_tempFilePath); - fileBeginLength = fileInfo.Length; - _fileOriginLength = fileBeginLength; - DownloadedBytes = _fileOriginLength; - } - - // 检测下载起始位置 - if (fileBeginLength >= Bundle.FileSize) - { - // 删除临时文件 - if (File.Exists(_tempFilePath)) + if (fileInfo.Length >= Bundle.FileSize) + { + // 删除临时文件 File.Delete(_tempFilePath); + } + else + { + fileBeginLength = fileInfo.Length; + _fileOriginLength = fileBeginLength; + DownloadedBytes = _fileOriginLength; + } } // 创建下载器