aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorDesmond Brand2013-04-27 15:21:17 -0700
committerMisty De Meo2013-05-09 09:21:34 -0500
commitfc565bee2603a2aaf3eaa79cdbc0e0ef85276ca6 (patch)
tree36465e738c70bdc787039f7a7e27fcc1011c2f60 /Library/Homebrew/extend
parent1bc3574fcc3b3c1d6a9aaf9cac66b67a51eac97a (diff)
downloadhomebrew-fc565bee2603a2aaf3eaa79cdbc0e0ef85276ca6.tar.bz2
Overwrite broken symlinks with --overwrite
Closes #19480. Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/pathname.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index ef7dcea99..25bb1e537 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -264,7 +264,20 @@ class Pathname
raise <<-EOS.undent
Could not symlink file: #{src.expand_path}
Target #{self} already exists. You may need to delete it.
- To force the link and delete this file, do:
+ To force the link and overwrite all other conflicting files, do:
+ brew link --overwrite formula_name
+
+ To list all files that would be deleted:
+ brew link --overwrite --dry-run formula_name
+ EOS
+ # #exist? will return false for symlinks whose target doesn't exist
+ elsif self.symlink?
+ raise <<-EOS.undent
+ Could not symlink file: #{src.expand_path}
+ Target #{self} already exists as a symlink to #{readlink}.
+ If this file is from another formula, you may need to
+ `brew unlink` it. Otherwise, you may want to delete it.
+ To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
To list all files that would be deleted: