From 22a961383a4c3519f5d807f0986168ec1ec2bebf Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 21 Oct 2013 17:06:31 +0000 Subject: dir.c: warn Dir.exists? * dir.c (rb_dir_exists_p): warn deprecated name. [Bug #9041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index 40e5537ceb..3844087667 100644 --- a/dir.c +++ b/dir.c @@ -2157,6 +2157,13 @@ rb_file_directory_p() } #endif +static VALUE +rb_dir_exists_p(VALUE obj, VALUE fname) +{ + rb_warning("Dir.exists? is a deprecated name, use Dir.exist? instead"); + return rb_file_directory_p(obj, fname); +} + /* * Objects of class Dir are directory streams representing * directories in the underlying file system. They provide a variety of @@ -2206,7 +2213,7 @@ Init_Dir(void) rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, -1); rb_define_singleton_method(rb_cDir,"[]", dir_s_aref, -1); rb_define_singleton_method(rb_cDir,"exist?", rb_file_directory_p, 1); - rb_define_singleton_method(rb_cDir,"exists?", rb_file_directory_p, 1); + rb_define_singleton_method(rb_cDir,"exists?", rb_dir_exists_p, 1); rb_define_singleton_method(rb_cFile,"fnmatch", file_s_fnmatch, -1); rb_define_singleton_method(rb_cFile,"fnmatch?", file_s_fnmatch, -1); -- cgit v1.2.3