Skip to content

Commit ed6b10a

Browse files
pakornvrasa
authored andcommitted
Fixed persisting bug when force update app with same version. (#2774)
1 parent ac15ed2 commit ed6b10a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

libexec/scoop-update.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ function update($app, $global, $quiet = $false, $independent, $suggested, $use_c
156156
# directory.
157157
$refdir = unlink_current $dir
158158

159+
if ($force -and ($old_version -eq $version)) {
160+
if (!(Test-Path "$dir/../_$version.old")) {
161+
Move-Item "$dir" "$dir/../_$version.old"
162+
} else {
163+
$i = 1
164+
While (Test-Path "$dir/../_$version.old($i)") {
165+
$i++
166+
}
167+
Move-Item "$dir" "$dir/../_$version.old($i)"
168+
}
169+
}
170+
159171
if($bucket) {
160172
# add bucket name it was installed from
161173
$app = "$bucket/$app"

0 commit comments

Comments
 (0)