From: <dan...@ya...> - 2001-08-24 01:06:07
|
--- Tony Kimball <al...@po...> wrote: > > I would agree with you Oscar, in a Posix-oriented world. > But not in a win32-oriented world. I don't mean to start > an argument, but do want to address each of your points. > Hopefully I will not overstate my case, so that the result > will be a balanced expression of both sides, and further > discussion won't be necessary in order to make all the > trade-offs clear. > > Quoth Oscar Fuentes on Thursday, 23 August: > : > : IMHO, it's clear that opendir should return ENOENT ("The directory > : does not exist"). > > yes, it should. but it can do this if the cancel button is pressed. > This is what happens if you opendir() or _stat an a:/ when the drive is empty. GetLastError returns 21 (ERROR_NOT_READY) if Ignore is pressed, or if this is in effect: SetErrorMode((SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX)); It returns 1235 (ERROR_REQUEST_ABORTED) if Abort is pressed. In either case, _stat returns 0 (success), sets st_mode to indicate a directory, and leaves errno alone. AFAIK, there is no errno that means the directory exists but is not ready. > : It would be a bad bad thing if a non-interactive app gets stuck by > : this. That is my feeling too. Most of my useful works gets done when I'm asleep. (I'm awake now if you're wondering) > > i don't think so. consider: it is only an issue for removable > media. And UNC names that can't be found: RAS autodial may pop up a dialog box asking if you want to dial-up. > there is a large body of win32 code which operates in this way. > it is the win32 way of doing things. there are other win32 calls > for doing a non-interactive check on removable media. doing it the > win32 way has an abstraction advantage, and simplifies code for more > typical applications, instead of optimizing the less common case. > But opendir() is POSIX. Nobody expects it to pop up a dialog box. w32 code doesn't usually know about it. If you want w32 GUI, use w32api functions. If you want portability, don't use w32api interface or opendir() - use ANSI functions. > : > : As a not so important consideration: AFAIK, there are no POSIX or > : Standard C ways for testing for the presence of removable media. > > but mingw is about win32 ways of doing things, For some, but not for all not a posix > adaptation layer. > > My comments would not apply to msys or cygwin, only to mingw. > One workaround would be a runtime check of subsystem: if console, then diasable the SEM dialog boxes, if GUI assume the user is awake and pop the question. I don't like that, because it means another silly rule to remember. Danny > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options at: > http://lists.sourceforge.net/lists/listinfo/mingw-users _____________________________________________________________________________ http://shopping.yahoo.com.au - Father's Day Shopping - Find the perfect gift for your Dad for Father's Day |