From: Nobuyoshi Nakada Date: 2008-04-25T13:39:57+09:00 Subject: Re: Dir.mkdir would be better if it returned a Dir object 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