mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use rb_warn_deprecated
for File.exists?
and Dir.exists?
This commit is contained in:
parent
b66d7d9be5
commit
a58bbd6a51
5 changed files with 5 additions and 32 deletions
2
dir.c
2
dir.c
|
@ -3498,7 +3498,7 @@ rb_file_directory_p(void)
|
|||
static VALUE
|
||||
rb_dir_exists_p(VALUE obj, VALUE fname)
|
||||
{
|
||||
rb_warning("Dir.exists? is a deprecated name, use Dir.exist? instead");
|
||||
rb_warn_deprecated("", "Dir.exist?");
|
||||
return rb_file_directory_p(obj, fname);
|
||||
}
|
||||
|
||||
|
|
8
file.c
8
file.c
|
@ -1782,16 +1782,16 @@ rb_file_exist_p(VALUE obj, VALUE fname)
|
|||
static VALUE
|
||||
rb_file_exists_p(VALUE obj, VALUE fname)
|
||||
{
|
||||
const char *s = "FileTest#";
|
||||
const char *s = "FileTest#exist?";
|
||||
if (obj == rb_mFileTest) {
|
||||
s = "FileTest.";
|
||||
s = "FileTest.exist?";
|
||||
}
|
||||
else if (obj == rb_cFile ||
|
||||
(RB_TYPE_P(obj, T_CLASS) &&
|
||||
RTEST(rb_class_inherited_p(obj, rb_cFile)))) {
|
||||
s = "File.";
|
||||
s = "File.exist?";
|
||||
}
|
||||
rb_warning("%sexists? is a deprecated name, use %sexist? instead", s, s);
|
||||
rb_warn_deprecated("", s);
|
||||
return rb_file_exist_p(obj, fname);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
require_relative '../../spec_helper'
|
||||
require_relative 'fixtures/common'
|
||||
require_relative 'shared/exist'
|
||||
|
||||
describe "Dir.exists?" do
|
||||
before :all do
|
||||
DirSpecs.create_mock_dirs
|
||||
end
|
||||
|
||||
after :all do
|
||||
DirSpecs.delete_mock_dirs
|
||||
end
|
||||
|
||||
it_behaves_like :dir_exist, :exists?
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require_relative '../../spec_helper'
|
||||
require_relative '../../shared/file/exist'
|
||||
|
||||
describe "File.exists?" do
|
||||
it_behaves_like :file_exist, :exists?, File
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require_relative '../../spec_helper'
|
||||
require_relative '../../shared/file/exist'
|
||||
|
||||
describe "FileTest.exists?" do
|
||||
it_behaves_like :file_exist, :exists?, FileTest
|
||||
end
|
Loading…
Reference in a new issue