Issue #16249 has been updated by nobu (Nobuyoshi Nakada).


```c
    return rb_dir_s_empty_p(rb_cDir, rb_str_dup(dirp->path));
```

This checks a directory named the current `Dir` object opened, instead of the opened directory itself.


----------------------------------------
Feature #16249: Dir#empty? and File#empty?
https://bugs.ruby-lang.org/issues/16249#change-81990

* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I don't think it is a super-valuable addition (as nobody complained about it, or I can't find similar proposals), but seems logical to me:

```ruby
# Existed since 2.4
Dir.empty?('dirname') #=> true/false
File.empty?('filename') # => true/false

# Proposed and implemented:
Dir.open('dirname').empty?
File.open('filename').empty?
```

---Files--------------------------------
file_dir_i_empty.patch (3.27 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>