diff src/dired-msw.c @ 819:6504113e7c2d

[xemacs-hg @ 2002-04-25 18:03:23 by andyp] sync up windows branch from 21.4
author andyp
date Thu, 25 Apr 2002 18:04:24 +0000
parents a5954632b187
children 6728e641994e
line wrap: on
line diff
--- a/src/dired-msw.c	Thu Apr 25 06:09:18 2002 +0000
+++ b/src/dired-msw.c	Thu Apr 25 18:04:24 2002 +0000
@@ -189,6 +189,7 @@
   int findex;
   DECLARE_EISTRING (win32pattern);
   HANDLE fh;
+  int				errm;
 
   while (1)
     {
@@ -221,6 +222,8 @@
        */
       findex = 0;
       fh = INVALID_HANDLE_VALUE;
+      errm = SetErrorMode (SEM_FAILCRITICALERRORS
+			   | SEM_NOOPENFILEERRORBOX);
 
       while (1)
 	{
@@ -234,15 +237,21 @@
 	    {
 	      fh = qxeFindFirstFile (eiextdata (win32pattern), &finddat);
 	      if (fh == INVALID_HANDLE_VALUE)
-		report_file_error ("Opening directory", dirfile);
+		{
+		  SetErrorMode (errm);
+		  report_file_error ("Opening directory", dirfile);
+		}
 	    }
 	  else
 	    {
 	      if (! qxeFindNextFile (fh, &finddat))
 		{
-		  if (GetLastError () == ERROR_NO_MORE_FILES)
-		    break;
-		  FindClose (fh);
+		  if (GetLastError() == ERROR_NO_MORE_FILES)
+		    {
+		      break;
+		    }
+		  FindClose(fh);
+		  SetErrorMode (errm);
 		  report_file_error ("Reading directory", dirfile);
 		}
 	    }
@@ -283,6 +292,8 @@
 	FindClose (fh);
       break;
     }
+
+  SetErrorMode (errm);
   return (files);
 }