修复文件占用问题
This commit is contained in:
parent
d1ffac817d
commit
6e92acfda9
|
@ -146,10 +146,12 @@ namespace N_m3u8DL_RE.Util
|
||||||
var deGzipFile = Path.ChangeExtension(filePath, ".dezip_tmp");
|
var deGzipFile = Path.ChangeExtension(filePath, ".dezip_tmp");
|
||||||
try
|
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 decompressedStream = File.Create(deGzipFile);
|
||||||
await using var decompressionStream = new GZipStream(fileToDecompressAsStream, CompressionMode.Decompress);
|
await using var decompressionStream = new GZipStream(fileToDecompressAsStream, CompressionMode.Decompress);
|
||||||
await decompressionStream.CopyToAsync(decompressedStream);
|
await decompressionStream.CopyToAsync(decompressedStream);
|
||||||
|
};
|
||||||
File.Delete(filePath);
|
File.Delete(filePath);
|
||||||
File.Move(deGzipFile, filePath);
|
File.Move(deGzipFile, filePath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue