]> git.saurik.com Git - wxWidgets.git/commitdiff
lame temporary "fix" for file names which are not UTF-8 encoded
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 24 Mar 2005 02:42:15 +0000 (02:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 24 Mar 2005 02:42:15 +0000 (02:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/filedlg.cpp
src/gtk1/filedlg.cpp

index e1082ea83eccef1268cb0967d18b0ee39193be5e..3c909e79bfc7e4360174862106198191955baad6 100644 (file)
@@ -21,6 +21,7 @@
 #include "wx/intl.h"
 #include "wx/filename.h"
 #include "wx/msgdlg.h"
+#include "wx/log.h"
 
 #include <gtk/gtk.h>
 
@@ -44,6 +45,12 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
     int style = dialog->GetStyle();
     gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
     wxString filename(wxGTK_CONV_BACK(text));
+    if ( filename.empty() )
+    {
+        // this is totally lame but better than silent error
+        wxLogWarning(_("This filename can't be used by wxWidgets because it contains invalid UTF-8 characters, please rename the file."));
+        return;
+    }
 
     if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
     {
index e1082ea83eccef1268cb0967d18b0ee39193be5e..3c909e79bfc7e4360174862106198191955baad6 100644 (file)
@@ -21,6 +21,7 @@
 #include "wx/intl.h"
 #include "wx/filename.h"
 #include "wx/msgdlg.h"
+#include "wx/log.h"
 
 #include <gtk/gtk.h>
 
@@ -44,6 +45,12 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
     int style = dialog->GetStyle();
     gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
     wxString filename(wxGTK_CONV_BACK(text));
+    if ( filename.empty() )
+    {
+        // this is totally lame but better than silent error
+        wxLogWarning(_("This filename can't be used by wxWidgets because it contains invalid UTF-8 characters, please rename the file."));
+        return;
+    }
 
     if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
     {