diff options
Diffstat (limited to 'Library/Homebrew/keg.rb')
| -rw-r--r-- | Library/Homebrew/keg.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 93e8b7857..6218668d6 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -37,6 +37,8 @@ class Keg < Pathname # of files and directories linked $n=$d=0 + dirs = [] + TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |dir| next unless dir.exist? dir.find do |src| @@ -44,6 +46,8 @@ class Keg < Pathname dst = HOMEBREW_PREFIX + src.relative_path_from(self) dst.extend(ObserverPathnameExtension) + dirs << dst if dst.directory? && !dst.symlink? + # check whether the file to be unlinked is from the current keg first if !dst.symlink? || !dst.exist? || src != dst.resolved_path next @@ -51,11 +55,13 @@ class Keg < Pathname dst.uninstall_info if dst.to_s =~ INFOFILE_RX and ENV['HOMEBREW_KEEP_INFO'] dst.unlink - dst.parent.extend(ObserverPathnameExtension).rmdir_if_possible Find.prune if src.directory? end end linked_keg_record.unlink if linked_keg_record.symlink? + + dirs.reverse_each(&:rmdir_if_possible) + $n+$d end |
