[Python-checkins] CVS: distutils/misc install.c,1.14,1.15

Thomas Heller theller@users.sourceforge.net
Tue, 18 Dec 2001 12:57:47 -0800


Update of /cvsroot/python/distutils/misc
In directory usw-pr-cvs1:/tmp/cvs-serv13561

Modified Files:
	install.c 
Log Message:
The installer does not overwrite files without confirmation from the
user. Before the first overwrite, he could select between 'ask before
each file', 'overwrite all files', and 'never overwrite files'.
If he selected to ask individually, he could not change his mind later,
and had to confirm possibly hundreds of questions.
There may be better possibilities than this fix, but for now, I simply
removed the first option.


Index: install.c
===================================================================
RCS file: /cvsroot/python/distutils/misc/install.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** install.c	2001/12/18 20:32:06	1.14
--- install.c	2001/12/18 20:57:45	1.15
***************
*** 124,128 ****
  	/* lParam: points to pathname */
  
! enum { UNSPECIFIED, ASK, ALWAYS, NEVER } allow_overwrite = UNSPECIFIED;
  
  static BOOL notify (int code, char *fmt, ...);
--- 124,128 ----
  	/* lParam: points to pathname */
  
! enum { UNSPECIFIED, ALWAYS, NEVER } allow_overwrite = UNSPECIFIED;
  
  static BOOL notify (int code, char *fmt, ...);
***************
*** 328,351 ****
      if (allow_overwrite == NEVER)
  	return FALSE;
!     if (allow_overwrite == ASK)
!         return (IDYES == MessageBox (hwndMain,
! 			    filename,
! 			    "Overwrite existing file?",
! 			    MB_YESNO | MB_ICONQUESTION));
! 
!     result = MessageBox (hwndMain,
  "Overwrite existing files?\n"
  "\n"
  "Press YES to ALWAYS overwrite existing files,\n"
! "press NO to NEVER overwrite existing files,\n"
! "press CANCEL to ASK individually.",
  		         "Overwrite options",
! 			 MB_YESNOCANCEL | MB_ICONQUESTION);
      if (result == IDYES)
  	allow_overwrite = ALWAYS;
      else if (result == IDNO)
  	allow_overwrite = NEVER;
-     else
- 	allow_overwrite = ASK;
      goto again;
  }
--- 328,342 ----
      if (allow_overwrite == NEVER)
  	return FALSE;
!     result = MessageBox (hDialog,
  "Overwrite existing files?\n"
  "\n"
  "Press YES to ALWAYS overwrite existing files,\n"
! "press NO to NEVER overwrite existing files.",
  		         "Overwrite options",
! 			 MB_YESNO | MB_ICONQUESTION);
      if (result == IDYES)
  	allow_overwrite = ALWAYS;
      else if (result == IDNO)
  	allow_overwrite = NEVER;
      goto again;
  }