Author: aolk
Date: 2006-06-08 15:54:24 -0400 (Thu, 08 Jun 2006)
New Revision: 61583

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
Log:
        * FileDialog.cs: When creating a new folder don't crash if the
          folder already exists.

2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-08 19:12:53 UTC (rev 61582)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-08 19:54:24 UTC (rev 61583)
@@ -1,5 +1,10 @@
 2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>
 
+       * FileDialog.cs: When creating a new folder don't crash if the
+         folder already exists.
+
+2006-06-08  Alexander Olk  <[EMAIL PROTECTED]>
+
        * FileDialog.cs: Allmost a complete rewrite.
          - added a "virtual" file system that handles the differences
            between unix and windows file systems (especially the directory

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-06-08 19:12:53 UTC (rev 61582)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FileDialog.cs    
2006-06-08 19:54:24 UTC (rev 61583)
@@ -2720,7 +2720,18 @@
                public bool CreateFolder (string new_folder)
                {
                        try {
-                               Directory.CreateDirectory (new_folder);
+                               if (Directory.Exists (new_folder)) {
+                                       int i = 1;
+                                       string folder = new_folder + "[" + i + 
"]";
+                                       
+                                       while (Directory.Exists(folder)) {
+                                               i++;
+                                               folder = new_folder + "[" + i + 
"]";
+                                       }
+                                       
+                                       Directory.CreateDirectory (folder);
+                               } else
+                                       Directory.CreateDirectory (new_folder);
                        } catch (Exception) {
                                return false;
                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to