mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Pass relative paths into link exceptions
This commit is contained in:
parent
fbe8dc8fc6
commit
07e00061a7
@ -37,7 +37,7 @@ class Keg
|
|||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
s = []
|
s = []
|
||||||
s << "Could not symlink #{src.relative_path_from(Pathname(keg))}"
|
s << "Could not symlink #{src}"
|
||||||
s << "Target #{dst}" << suggestion
|
s << "Target #{dst}" << suggestion
|
||||||
s << <<-EOS.undent
|
s << <<-EOS.undent
|
||||||
To force the link and overwrite all conflicting files:
|
To force the link and overwrite all conflicting files:
|
||||||
@ -52,7 +52,7 @@ class Keg
|
|||||||
|
|
||||||
class DirectoryNotWritableError < LinkError
|
class DirectoryNotWritableError < LinkError
|
||||||
def to_s; <<-EOS.undent
|
def to_s; <<-EOS.undent
|
||||||
Could not symlink #{src.relative_path_from(Pathname(keg))}
|
Could not symlink #{src}
|
||||||
#{dst.dirname} is not writable.
|
#{dst.dirname} is not writable.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
@ -362,15 +362,15 @@ class Keg
|
|||||||
dst.make_relative_symlink(src)
|
dst.make_relative_symlink(src)
|
||||||
rescue Errno::EEXIST
|
rescue Errno::EEXIST
|
||||||
if dst.exist?
|
if dst.exist?
|
||||||
raise ConflictError.new(self, src, dst)
|
raise ConflictError.new(self, src.relative_path_from(path), dst)
|
||||||
elsif dst.symlink?
|
elsif dst.symlink?
|
||||||
dst.unlink
|
dst.unlink
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
rescue Errno::EACCES
|
rescue Errno::EACCES
|
||||||
raise DirectoryNotWritableError.new(self, src, dst)
|
raise DirectoryNotWritableError.new(self, src.relative_path_from(path), dst)
|
||||||
rescue SystemCallError
|
rescue SystemCallError
|
||||||
raise LinkError.new(self, src, dst)
|
raise LinkError.new(self, src.relative_path_from(path), dst)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user