win32utils-devel@rubyforge.org
2004-Nov-11 01:17 UTC
[Win32utils-devel] File.open on a directory?
Hi all, Windows 2000 Ruby 1.8.2 RC9 Is it possible to call File.open on a directory in Windows? I always get Errno::EACCES, even though there are no special settings on the directories I''ve tried and I have full access. Dan
win32utils-devel@rubyforge.org
2004-Nov-11 02:49 UTC
[Win32utils-devel] File.open on a directory?
Hi,> > Hi all, > > Windows 2000 > Ruby 1.8.2 RC9 > > Is it possible to call File.open on a directory in Windows? I always get > Errno::EACCES, even though there are no special settings on the directories > I''ve tried and I have full access. > > Dan >The open function cannot open directory on Windows. it returns EACCES if given path is directory. You should use CreateFile function to open directory. Opening a directory with CreateFile requires the FILE_FLAG_BACKUP_SEMANTICS flag. Refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__open.2c_._wopen.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp Regards, Park Heesob --MIME Multi-part separator--
win32utils-devel@rubyforge.org
2004-Nov-11 10:45 UTC
[Win32utils-devel] File.open on a directory?
> -----Original Message----- > From: win32utils-devel-bounces@rubyforge.org > [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of > win32utils-devel@rubyforge.org > Sent: Thursday, November 11, 2004 12:50 AM > To: win32utils-devel@rubyforge.org > Subject: Re:[Win32utils-devel] File.open on a directory?<snip>> > > The open function cannot open directory on Windows. it > returns EACCES if given path is directory. > > You should use CreateFile function to open directory. > Opening a directory with CreateFile requires the > FILE_FLAG_BACKUP_SEMANTICS flag.Time for the ''dopen'' class method. :) Dan