]> khamidou — GitHub mirrors - electron.git/commitdiff
Set default extension in Windows file dialog
authorEran Tiktin <eran.t@mce-sys.com>
Sun, 27 Sep 2015 23:12:47 +0000 (02:12 +0300)
committerEran Tiktin <eran.t@mce-sys.com>
Sun, 27 Sep 2015 23:12:47 +0000 (02:12 +0300)
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

index b169471c6e99d52bf3887616d8da8a7bdf96c1a6..da00dc54e2fc684034c1a028311c654347efa3ab 100644 (file)
@@ -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);
   }