summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-21 15:34:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-21 15:34:55 +0000
commit1ca90beaac396f880a39c964b38c94ea09189da2 (patch)
tree036d41a0f7746f95eddc61dd7b27422f5732dd92 /file.c
parent68b85e9d9290dfc28e72e006aed8147117e885d8 (diff)
* file.c (rb_file_exists_p): maybe FileTest.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/file.c b/file.c
index 1468afe149..a6b5373f09 100644
--- a/file.c
+++ b/file.c
@@ -1400,7 +1400,16 @@ rb_file_exist_p(VALUE obj, VALUE fname)
static VALUE
rb_file_exists_p(VALUE obj, VALUE fname)
{
- rb_warning("File.exists? is deprecated name, use File.exist? instead");
+ const char *s = "FileTest#";
+ if (obj == rb_mFileTest) {
+ s = "FileTest.";
+ }
+ else if (obj == rb_cFile ||
+ (RB_TYPE_P(obj, T_CLASS) &&
+ RTEST(rb_class_inherited_p(obj, rb_cFile)))) {
+ s = "File.";
+ }
+ rb_warning("%sexists? is deprecated name, use %sexist? instead", s, s);
return rb_file_exist_p(obj, fname);
}