aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dir.c9
-rw-r--r--file.c2
2 files changed, 9 insertions, 2 deletions
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 <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);
diff --git a/file.c b/file.c
index a6b5373f09..acbaa5c5f4 100644
--- a/file.c
+++ b/file.c
@@ -1409,7 +1409,7 @@ rb_file_exists_p(VALUE obj, VALUE fname)
RTEST(rb_class_inherited_p(obj, rb_cFile)))) {
s = "File.";
}
- rb_warning("%sexists? is deprecated name, use %sexist? instead", s, s);
+ rb_warning("%sexists? is a deprecated name, use %sexist? instead", s, s);
return rb_file_exist_p(obj, fname);
}