Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
r15ch13 committed Nov 6, 2017
1 parent e008f6f commit df4b213
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -184,35 +184,31 @@ function unzip($path, $to) {
if ($retries -eq 10) {
if (7zip_installed) {
extract_7zip $path $to $false
return
}
else {
return
} else {
abort "Unzip failed: Windows can't unzip because a process is locking the file.`nRun 'scoop install 7zip' and try again."
}
}
if (isFileLocked $path) {
write-host "Waiting for $path to be unlocked by another process... ($retries/10)"
$retries++
Start-Sleep -s 2
}
else {
} else {
break
}
}

try {
[io.compression.zipfile]::extracttodirectory($path, $to)
}
catch [system.io.pathtoolongexception] {
} catch [system.io.pathtoolongexception] {
# try to fall back to 7zip if path is too long
if (7zip_installed) {
extract_7zip $path $to $false
return
}
else {
} else {
abort "Unzip failed: Windows can't handle the long paths in this zip file.`nRun 'scoop install 7zip' and try again."
}
}
catch {
} catch {
abort "Unzip failed: $_"
}
}
Expand Down

0 comments on commit df4b213

Please sign in to comment.