Merge pull request #1860 from atom/dialog-show-file-name
Fix dialog.showSaveDialog doesn't show the non-exist file name on Linux.
This commit is contained in:
commit
fed9ef0687
1 changed files with 7 additions and 4 deletions
|
@ -93,12 +93,15 @@ class FileChooserDialog {
|
||||||
gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
|
gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
|
||||||
|
|
||||||
if (!default_path.empty()) {
|
if (!default_path.empty()) {
|
||||||
if (base::DirectoryExists(default_path))
|
if (base::DirectoryExists(default_path)) {
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_),
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_),
|
||||||
default_path.value().c_str());
|
default_path.value().c_str());
|
||||||
else
|
} else {
|
||||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog_),
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog_),
|
||||||
default_path.value().c_str());
|
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())
|
if (!filters.empty())
|
||||||
|
|
Loading…
Reference in a new issue