Skip to content

Commit

Permalink
Merge pull request #18946 from vidishanevatia/fix-cask-list-symlinks
Browse files Browse the repository at this point in the history
Fixes  #18849 :  fix duplicate casks when symlinks exist
  • Loading branch information
MikeMcQuaid authored Dec 17, 2024
2 parents d43fa1f + 4403280 commit 6d2a500
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Library/Homebrew/cmd/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,15 @@ def filtered_list
sig { void }
def list_casks
casks = if args.no_named?
Cask::Caskroom.casks
cask_paths = Cask::Caskroom.path.children.map do |path|
if path.symlink?
real_path = path.realpath
real_path.basename.to_s
else
path.basename.to_s
end
end.uniq
cask_paths.map { |name| Cask::CaskLoader.load(name) }
else
filtered_args = args.named.dup.delete_if do |n|
Homebrew.failed = true unless Cask::Caskroom.path.join(n).exist?
Expand Down

0 comments on commit 6d2a500

Please sign in to comment.