diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index 11e019af2c..dfd6008cf0 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -71,7 +71,7 @@ module Hbc command.run("/bin/mv", args: [target, source], sudo: true) end - add_altname_metadata(target, source.basename, command: command) + add_altname_metadata(source, target.basename, command: command) end def delete(target, force: false, command: nil, **_) diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 84a8ac9b74..3dd2a79907 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -452,8 +452,11 @@ module Hbc ohai "Purging files for version #{@cask.version} of Cask #{@cask}" # versioned staged distribution - staged_path = version_is_latest? ? - backup_path(@cask.staged_path) : @cask.staged_path + if version_is_latest? + staged_path = backup_path(@cask.staged_path) + else + staged_path = @cask.staged_path + end gain_permissions_remove(staged_path) if !staged_path.nil? && staged_path.exist?