Skip to content

Commit

Permalink
修复文件占用问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Oct 21, 2024
1 parent d1ffac8 commit 6e92acf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/N_m3u8DL-RE/Util/OtherUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ public static async Task DeGzipFileAsync(string filePath)
var deGzipFile = Path.ChangeExtension(filePath, ".dezip_tmp");
try
{
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);
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);
}
Expand Down

0 comments on commit 6e92acf

Please sign in to comment.