aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMisty De Meo2012-04-08 23:27:34 -0500
committerMisty De Meo2012-04-09 10:09:19 -0500
commit31394247e42934ecab1015bed38bb321daea5903 (patch)
treeb0779746d5744590a5dbd194fdaf66d7875d805a /Library/Homebrew
parent9b3044fa28d3f63068f3a2e6b44b982f998a3a45 (diff)
downloadhomebrew-31394247e42934ecab1015bed38bb321daea5903.tar.bz2
make_relative_symlink: give more specific advice
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/extend/pathname.rb22
1 files changed, 17 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 797c89b7e..454afb074 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -293,11 +293,23 @@ class Pathname
# NOTE only system ln -s will create RELATIVE symlinks
quiet_system 'ln', '-s', src.relative_path_from(self.dirname), self.basename
if not $?.success?
- raise <<-EOS.undent
- Could not symlink file: #{src.expand_path}
- Check #{self} does not already exist.
- Check #{dirname} is writable.
- EOS
+ if self.exist?
+ raise <<-EOS.undent
+ Could not symlink file: #{src.expand_path}
+ Target #{self} already exists. You may need to delete it.
+ EOS
+ elsif !dirname.writable?
+ raise <<-EOS.undent
+ Could not symlink file: #{src.expand_path}
+ #{dirname} is not writable. You should change its permissions.
+ EOS
+ else
+ raise <<-EOS.undent
+ Could not symlink file: #{src.expand_path}
+ #{self} may already exist.
+ #{dirname} may not be writable.
+ EOS
+ end
end
end
end