[Mono-winforms-list] FileDialog.cs bug fix suggestion

vlindos at nucleusys.com vlindos at nucleusys.com
Tue Jul 19 08:24:03 EDT 2005


Hi there,
One more little bug on Windows.Forms/FileDialog.cs. If we press side
button Desktop and there is no %HOME%/Desktop directory -- program will be
thrown with exception of no such directory. Here is diff suggestion for
fixing this problem, but may be should change to the root directory in
case of no existing directory. Other ideas?

Index: System.Windows.Forms/FileDialog.cs
===================================================================
--- System.Windows.Forms/FileDialog.cs  (revision 47407)
+++ System.Windows.Forms/FileDialog.cs  (working copy)
@@ -1426,12 +1426,14 @@
                                        else
                                        if ( sender == desktopButton )
                                        {
-                                              
fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath(
Environment.SpecialFolder.Desktop ) );
+                                               if ( File.Exists(
Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) ) )
+                                                      
fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath(
Environment.SpecialFolder.Desktop ) );
                                        }
                                        else
                                        if ( sender == homeButton )
                                        {
-                                              
fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath(
Environment.SpecialFolder.Personal ) );
+                                               if( File.Exists(
Environment.GetFolderPath( Environment.SpecialFolder.Personal ) ) )
+                                                      
fileDialogPanel.ChangeDirectory( this, Environment.GetFolderPath(
Environment.SpecialFolder.Personal ) );
                                        }
                                        else
                                        if ( sender == workplaceButton )




More information about the Mono-winforms-list mailing list