diff options
| author | Tim D. Smith | 2017-04-02 08:19:29 -0700 |
|---|---|---|
| committer | Tim D. Smith | 2017-04-02 08:19:29 -0700 |
| commit | d0feae0632e29194d09a26adf961a05de760a22a (patch) | |
| tree | 396a53052cc960138cb7e9debeaefb3aa6f865be /Library/Homebrew | |
| parent | 51c4c84a3f39a64d4694beebd15952d2cf1ae664 (diff) | |
| download | brew-d0feae0632e29194d09a26adf961a05de760a22a.tar.bz2 | |
Unlink before rewriting link
ln_sf does the right thing when `dest` is a symlink pointing to a file:
the symlink gets overwritten with a link pointing to the new src. But
when dest points to a directory, we create a new symlink inside the
folder dest points to, which doesn't help us at all.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/keg_relocate.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 00e941ce2..0b1a1bc94 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -17,7 +17,9 @@ class Keg # Don't fix relative symlinks next unless link.absolute? if link.to_s.start_with?(HOMEBREW_CELLAR.to_s) || link.to_s.start_with?(HOMEBREW_PREFIX.to_s) - FileUtils.ln_sf(link.relative_path_from(file.parent), file) + new_src = link.relative_path_from(file.parent) + file.unlink + FileUtils.ln_s(new_src, file) end end end |
