From: Hanlyu Sarang Date: 2016-02-16T11:51:04-06:00 Subject: [ruby-core:73853] Re: [Ruby trunk Feature#10121] Dir.empty? --===============0749119565== Content-Type: multipart/alternative; boundary=047d7b3a7f78fab163052be6c643 --047d7b3a7f78fab163052be6c643 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable on windows, i also have to take "desktop.ini" files into consideration, and on mac there are ".DS_Store" files; none of these are truly directory contents, but rather for directory configuration; =E2=80=8B=E2=80=8B ignores =3D [ '..', '.', 'desktop.ini', '.DS_Store' ] and there are even more .files and .directories on *nix, graphical *nix and virtual *nix systems, none of which are truly directory contents; On Tue, Feb 16, 2016 at 11:05 AM, wrote: > Issue #10121 has been updated by Robert A. Heiler. > > > Woot! Woot! > > Thanks to nobu the patch monster and matz! > > ---------------------------------------- > Feature #10121: Dir.empty? > https://bugs.ruby-lang.org/issues/10121#change-57024 > > * Author: Robert A. Heiler > * Status: Closed > * Priority: Normal > * Assignee: Yukihiro Matsumoto > ---------------------------------------- > On IRC someone asked how to find out if a directory is empty or not, from > within ruby. > > It seems as if there was no simple way. > > I suggest adding `Dir.empty?` > > On IRC, someone else suggested this: > > ~~~ruby > Dir.entries(dir).size =3D=3D 2 > ~~~ > > I do not know if there are better ways but possibly that could > be used for a `Dir.empty?` functionality? > > > > -- > https://bugs.ruby-lang.org/ > > Unsubscribe: > > --047d7b3a7f78fab163052be6c643 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
on windows, i also have to take "desktop.ini" fi= les into consideration, and on mac there are ".DS_Store" files; n= one of these are truly directory contents, but rather for directory configu= ration;

=E2=80=8B=E2=80=8B
ignor= es =3D [ '..', '.', 'desktop.ini', '.DS_Store&#= 39; ]


and there are even more .files and .directories on *nix= , graphical *nix and virtual *nix systems, none of which are truly director= y contents;


On Tue, Feb 16, 2016 at 1= 1:05 AM, <shevegen@gmail.com> wrote:
Issue #10121 has been updated by Robert A. Heiler.


Woot! Woot!

Thanks to nobu the patch monster and matz!

----------------------------------------
Feature #10121: Dir.empty?
https://bugs.ruby-lang.org/issues/10121#change-5= 7024

* Author: Robert A. Heiler
* Status: Closed
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
On IRC someone asked how to find out if a directory is empty or not, from w= ithin ruby.

It seems as if there was no simple way.

I suggest adding `Dir.empty?`

On IRC, someone else suggested this:

~~~ruby
Dir.entries(dir).size =3D=3D 2
~~~

I do not know if there are better ways but possibly that could
be used for a `Dir.empty?` functionality?



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

Unsubscribe: <mailto:= ruby-core-request@ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/m= ailman/options/ruby-core>

--047d7b3a7f78fab163052be6c643-- --===============0749119565== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Unsubscribe: --===============0749119565==--