From 63e7fb5cae12ad751b4f3f83f6aa767d7c3c9f00 Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Tue, 22 Nov 2016 03:08:10 +0900 Subject: [PATCH] cask: Delete package dir if it is symlink on the uninstall When a Formula is converted into a Cask (e.g. osxfuse), a symlink remains at the place of package dir. This change ensure to remove such leftovers. --- Library/Homebrew/cask/lib/hbc/pkg.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/pkg.rb b/Library/Homebrew/cask/lib/hbc/pkg.rb index eacd5157e1..2fb634f248 100644 --- a/Library/Homebrew/cask/lib/hbc/pkg.rb +++ b/Library/Homebrew/cask/lib/hbc/pkg.rb @@ -72,7 +72,12 @@ module Hbc end def _rmdir(path) - @command.run!("/bin/rmdir", args: ["--", path], sudo: true) if path.children.empty? + return unless path.children.empty? + if path.symlink? + @command.run!("/bin/rm", args: ["-f", "--", path], sudo: true) + else + @command.run!("/bin/rmdir", args: ["--", path], sudo: true) + end end def _with_full_permissions(path)