Ignore unfinished browser downloads

This commit is contained in:
Manuel Thalmann 2024-08-16 17:57:22 +02:00
parent 5cdd8c10a0
commit 596073974b

View file

@ -68,19 +68,19 @@ $null = New-Module {
$downloadChecker = { $downloadChecker = {
$files = Get-ChildItem $dir; $files = Get-ChildItem $dir;
if ((@($files)).Count -gt 0) { if ((@($files)).Count -eq 1) {
foreach ($file in $files) { $file = $files[0];
try {
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None); try {
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
if ($stream) {
$stream.Close(); if ($stream) {
} $stream.Close();
}
catch {
return $true;
} }
} }
catch {
return $true;
}
return $false; return $false;
} else { } else {