Re: _wstat on Windows (actually stat stuff in general)



Ugh, how weird and unexpected. (My expectation would have been that
neither supports symbolic links.) For which C runtime is this, btw,
the system msvcrt.dll, or some of the MSVC-version-specific ones?
The MSDN documentation doesn't specify. I suspect its all of them TBH.

Instead, we should just use the Win32 API to fill in the meaningful
fields of a struct stat. Yeah, following symbolic links manually might
be painful; I have no idea how to do that.
Well I speak under correction but its my belief that The other API's follow them for you. I'm fairly certain GetFileAttributesEx() does.

(Of course, when I say "we", I actually mean "you", as I don't really
take much part in GLib/GTK+ development currently... sorry. Just
noticed this thread when browsing the gtk-devel-list archove, and
*had* to follow-up...)
Glad you did :)

That is a glaring omission only if you misunderstand the purpose of
gstdio.h. It is not supposed to be a wrapper for any file I/O related
functions. Its sole purpose (at least when it was created) is to take
care of the *file name* problems. It even says this in a comment:
Ah I had missed that bit.

Beafing up gstdio.h now is too late. All newer file system portability
related stuff in GLib is in GIO, surely.
Sure but if all I want to know how big a file is, do I *really* want to link in all of that extra crud? GIO is huge. There are times when the low level functions are just plain appropriate.

I've given up on the idea of a universal stat structure, but the g_stat() wrapper is still useful on Windows exactly because of the file name issue. People really do want to use stat rather than GIO. I do, and I've had private emails from others who do too. Right now though the biggest deficiency with it (aside from the symlinks and _wstat thing which needs to be addressed differently) is the actual stat structure you chose. It only supports 32-bit (well 31) file sizes and that's a real problem on Windows these days where ISO images are frequent and much larger than 2GB. I would dearly *love* to change that but that will mean breaking the ABI. Of course since everyone is off using GIO that shouldn't break too many people should it :) But that structure can be changed in a non-ABI breaking way and I hope to at least get that much past the powers that be.

Kean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]