make_relative_symlink: give more specific advice

This commit is contained in:
Misty De Meo 2012-04-08 23:27:34 -05:00
parent c9fd1b9bf0
commit 90400eceb1

View File

@ -293,11 +293,23 @@ class Pathname
# NOTE only system ln -s will create RELATIVE symlinks # NOTE only system ln -s will create RELATIVE symlinks
quiet_system 'ln', '-s', src.relative_path_from(self.dirname), self.basename quiet_system 'ln', '-s', src.relative_path_from(self.dirname), self.basename
if not $?.success? if not $?.success?
if self.exist?
raise <<-EOS.undent raise <<-EOS.undent
Could not symlink file: #{src.expand_path} Could not symlink file: #{src.expand_path}
Check #{self} does not already exist. Target #{self} already exists. You may need to delete it.
Check #{dirname} is writable.
EOS 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 end
end end