From 1cd125e7e76fa4cc0edf5eb2428d705567cdfef7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 20 Apr 2017 10:48:32 +0200 Subject: Refactor cask metadata directory methods. --- Library/Homebrew/cask/lib/hbc/cli/uninstall.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/cask/lib/hbc/cli') diff --git a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb index 6887aaf4f..1ee3230ad 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/uninstall.rb @@ -12,15 +12,9 @@ module Hbc raise CaskNotInstalledError, cask unless cask.installed? || force - latest_installed_version = cask.timestamped_versions.last - - unless latest_installed_version.nil? - latest_installed_cask_file = cask.metadata_master_container_path - .join(latest_installed_version.join(File::Separator), - "Casks", "#{cask_token}.rb") - + if cask.installed? && !cask.installed_caskfile.nil? # use the same cask file that was used for installation, if possible - cask = CaskLoader.load_from_file(latest_installed_cask_file) if latest_installed_cask_file.exist? + cask = CaskLoader.load_from_file(cask.installed_caskfile) if cask.installed_caskfile.exist? end Installer.new(cask, force: force).uninstall -- cgit v1.2.3