修复文件占用问题

This commit is contained in:
nilaoda 2024-10-21 23:48:21 +08:00
parent d1ffac817d
commit 6e92acfda9
1 changed files with 6 additions and 4 deletions

View File

@ -146,10 +146,12 @@ namespace N_m3u8DL_RE.Util
var deGzipFile = Path.ChangeExtension(filePath, ".dezip_tmp");
try
{
await using var fileToDecompressAsStream = File.OpenRead(filePath);
await using (var fileToDecompressAsStream = File.OpenRead(filePath))
{
await using var decompressedStream = File.Create(deGzipFile);
await using var decompressionStream = new GZipStream(fileToDecompressAsStream, CompressionMode.Decompress);
await decompressionStream.CopyToAsync(decompressedStream);
};
File.Delete(filePath);
File.Move(deGzipFile, filePath);
}