summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-21 17:06:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-21 17:06:31 +0000
commit22a961383a4c3519f5d807f0986168ec1ec2bebf (patch)
treee37019c56ba76b24aa2d730e26f7b75a9688d0e4 /dir.c
parent1ca90beaac396f880a39c964b38c94ea09189da2 (diff)
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 40e5537..3844087 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 <code>Dir</code> 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);