diff options
| author | Vlad Shablinsky | 2015-08-12 16:13:10 +0300 |
|---|---|---|
| committer | Xu Cheng | 2015-08-15 20:16:31 +0800 |
| commit | 2c1d8bcf6582ec7efc9870f9d4e4e9275804ac7e (patch) | |
| tree | 0c7b2523a09cd374f079612f1d05df94cb4ee6b1 | |
| parent | 3c45e1e81d8c2c280acc91b1bce73fa4a97b626c (diff) | |
| download | brew-2c1d8bcf6582ec7efc9870f9d4e4e9275804ac7e.tar.bz2 | |
migrator: check if old_opt_record exist before using realpath
- check if old_opt_record exist before using realpath
- don’t check old_opt_record.exist? in link_old_opt
because it doesn’t have to exist.
| -rw-r--r-- | Library/Homebrew/migrator.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index fb01cf7f3..8e86d0853 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -223,7 +223,7 @@ class Migrator # Link keg to opt if it was linked before migrating. def link_oldname_opt if old_opt_record - old_opt_record.delete if old_opt_record.symlink? || old_opt_record.exist? + old_opt_record.delete if old_opt_record.symlink? old_opt_record.make_relative_symlink(formula.installed_prefix) end end @@ -241,8 +241,9 @@ class Migrator # Remove opt/oldname link if it belongs to newname. def unlink_oldname_opt return unless old_opt_record - if old_opt_record.symlink? && formula.installed_prefix.exist? \ - && formula.installed_prefix.realpath == old_opt_record.realpath + if (old_opt_record.symlink? && old_opt_record.exist?) \ + && formula.installed_prefix.exist? \ + && formula.installed_prefix.realpath == old_opt_record.realpath old_opt_record.unlink old_opt_record.parent.rmdir_if_possible end |
