cask/info: fix installed size reporting

This commit is contained in:
Justin Krehel 2024-07-15 11:24:38 -04:00
parent 8f863199bc
commit 0799222df2
No known key found for this signature in database

View File

@ -42,16 +42,15 @@ module Cask
return "Not installed" unless cask.installed?
versioned_staged_path = cask.caskroom_path.join(cask.installed_version)
path_details = if versioned_staged_path.exist?
versioned_staged_path.abv
else
Formatter.error("does not exist")
end
return "Installed\n#{versioned_staged_path} (#{Formatter.error("does not exist")})\n" unless versioned_staged_path.exist?
path_details = versioned_staged_path.children.sum(&:disk_usage)
tab = Tab.for_cask(cask)
info = ["Installed"]
info << "#{versioned_staged_path} (#{path_details})"
info << "#{versioned_staged_path} (#{disk_usage_readable(path_details)})"
info << " #{tab}" if tab.tabfile&.exist?
info.join("\n")
end