From 6dcc752f6742d150ce909ffffae270355234c608 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Mon, 28 Sep 2015 02:12:47 +0300 Subject: [PATCH] Set default extension in Windows file dialog On Windows when you open the save dialog and switch the filter, the extension is supposed to change accordingly. It didn't happen with the existing code, since the existing code didn't set the default extension (should be set to the first filter). This resolves #2915. --- atom/browser/ui/file_dialog_win.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index b169471c6e99..da00dc54e2fc 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -79,6 +79,9 @@ class FileDialog { if (!title.empty()) GetPtr()->SetTitle(base::UTF8ToUTF16(title).c_str()); + if (!filterspec.empty()) + GetPtr()->SetDefaultExtension(filterspec.front().pszSpec); + SetDefaultFolder(default_path); }