[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: Dir.mkdir would be better if it returned a Dir object
From:       Nobuyoshi Nakada <nobu () ruby-lang ! org>
Date:       2008-04-25 4:39:57
Message-ID: 20080425043944.D3C25E087A () mail ! bc9 ! jp
[Download RAW message or body]

Hi,

At Fri, 25 Apr 2008 13:03:08 +0900,
Urabe Shyouhei wrote in [ruby-core:16584]:
> > Dir.mkdir creates a directory and returns 0 on success.  It would be
> > better if Dir.mkdir returned a new Dir object that wrapped the file
> > descriptor that mkdir(2) returns.
> >
> > My immediate use case is that this would allow you to create temporary
> > directories as safely as files can currently be created.
> >
> > I'll gladly write the patch (and even more gladly let someone else do
> > it for me), but I would like input on this before I do.
> >
> > Thanks!
> >   
> 
> Feel free to post that patch, but also note that:
> (1) We already have Dir.mktmpdir once you require 'tmpdir'
> (2) Don't forget Windows and other systems which don't have file 
> descriptors.

All systems have or emulate file descriptors and Shyouhei meant
the systems which mkdir(2) doesn't return a file descriptor.
I've not seen nor heared yet about such systems, mkdir(2) opens
the created directory togegher, though.

-- 
Nobu Nakada

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic