On Thursday, July 22, 2010 09:44:08 Ozkan Sezer wrote: > On Thu, Jul 22, 2010 at 12:29 PM, Ruben Van Boxem > > <[email protected]> wrote: > > Hi, > > > > Would it be feasable to provide an extension to the POSIX dirent.h > > functionality? I found a small patch in some compatibility layer (in git > > source) that adds d_type to the DIR structure, which is currently > > missing. I discovered this when testing the POSIX code I was writing to > > list all files in a directory recursively. I thought mingw has a small > > compat layer to POSIX, but didn't realise it was this shallow. > > > > The link is: http://marc.info/?l=git&m=124386152125913 > > > > It would be great to have this included in the readdir functionality of > > mingw-w64. > > > > Ruben > > The functionality would be nice, yes, but new member in the DIR > structure means api change & breaking backwards compatibility. > I don't know how the admins would react to that. >
It would be nice. However: 1) d_type is a POSIX extension, which means that it isn't defined by POSIX to begin with, and may not be available to begin with. Considering that the Linux man pages even state that not all file system types support the d_type field anyway, the application may have to provide fallbacks to begin with because they would *have* to support the DT_UNKNOWN on those systems that do have the d_type field. 2) I'm not sure the licensing of the patch referenced (I didn't look at it except to see what it applied to). We'd have to do our own stuff. 3) The only file types that we would support are DT_REG and DT_DIR, which means I really don't see any high priority in this when the application can do the simple check for GetFileAttributes[Ex](dirent.d_name) & FILE_ATTRIBUTE_DIRECTORY on the result of the readdir (which, note, I don't think works directly on network shares themselves, you need to specify a subfolder on the share). By the way, I personally have no problem in *adding* structure members to our link time libraries that are not DLLs (libmingwex.a, etc), PROVIDED that we also provide some sort of feature test macro that would allow applications to determine whether the feature is available in the runtime against which they are linking...(the reason I say this is that the headers and libraries must match, so all the structures at compile time match --- if we provided runtime DLLs, that would definitely be a different story.) Doug ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
