From: Haojian Wu Date: Thu, 4 Jun 2015 02:08:16 +0000 (+0800) Subject: Fix dialog.showSaveDialog doesn't show the non-exist file name on Linux. X-Git-Tag: v0.28.0~32^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=da83ba6c06153827a3e1f7849db3a00d2a168ea6;p=electron.git Fix dialog.showSaveDialog doesn't show the non-exist file name on Linux. --- diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index 0a74cf75..40c14028 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -93,12 +93,15 @@ class FileChooserDialog { gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); if (!default_path.empty()) { - if (base::DirectoryExists(default_path)) + if (base::DirectoryExists(default_path)) { gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_), default_path.value().c_str()); - else - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog_), - default_path.value().c_str()); + } else { + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_), + default_path.DirName().value().c_str()); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog_), + default_path.BaseName().value().c_str()); + } } if (!filters.empty())