Skip to content
Snippets Groups Projects
Commit d0feae06 authored by Tim D. Smith's avatar Tim D. Smith
Browse files

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.
parent 51c4c84a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment