From dc9603bd5c6b9618e1f4aa8a48c020c56425366f Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 3 Dec 2003 18:51:23 +0000 Subject: [PATCH] * lib/pathname.rb (Pathname#link, Pathname#symlink): obsoleted. (Pathname#make_link, Pathname#make_symlink): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/pathname.rb | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f290088c8..03ecceb6a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Dec 4 03:48:59 2003 Tanaka Akira + + * lib/pathname.rb (Pathname#link, Pathname#symlink): obsoleted. + (Pathname#make_link, Pathname#make_symlink): new method. + Thu Dec 4 01:45:24 2003 Yukihiro Matsumoto * io.c (argf_read): should not terminate on empty string; wait diff --git a/lib/pathname.rb b/lib/pathname.rb index 027886ccd0..0cd0c9a377 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -360,13 +360,13 @@ class Pathname def fnmatch(pattern, *args) File.fnmatch(pattern, @path, *args) end def fnmatch?(pattern, *args) File.fnmatch?(pattern, @path, *args) end def ftype() File.ftype(@path) end - def link(old) File.link(old, @path) end + def make_link(old) File.link(old, @path) end def open(*args, &block) File.open(@path, *args, &block) end def readlink() Pathname.new(File.readlink(@path)) end def rename(to) File.rename(@path, to) end def stat() File.stat(@path) end def lstat() File.lstat(@path) end - def symlink(old) File.symlink(old, @path) end + def make_symlink(old) File.symlink(old, @path) end def truncate(length) File.truncate(@path, length) end def utime(atime, mtime) File.utime(atime, mtime, @path) end def basename(*args) Pathname.new(File.basename(@path, *args)) end @@ -374,6 +374,20 @@ class Pathname def extname() File.extname(@path) end def expand_path(*args) Pathname.new(File.expand_path(@path, *args)) end def split() File.split(@path).map {|f| Pathname.new(f) } end + + # Pathname#link is confusing and obsoleted because the receiver/argument + # order is inverted to corresponding system call. + def link(old) + warn 'Pathname#link is obsoleted. Use Pathname#make_link.' + File.link(old, @path) + end + + # Pathname#symlink is confusing and obsoleted because the receiver/argument + # order is inverted to corresponding system call. + def symlink(old) + warn 'Pathname#symlink is obsoleted. Use Pathname#make_symlink.' + File.symlink(old, @path) + end end # FileTest