Open rmobis opened 5 years ago
Same problem here.
On Mac, it works fine, and on the windows, It always appears "All files *".
For this demo, I used the URL(https://codepen.io/tongdada-the-sans/pen/OKjxgJ
) in my electron.
And the images:
As for how to resolve this situation, I just found a solution as far that appending a suffix on the filename, although It already has a .ext
on its name. see below.
On windows10, we can add two ext
on the filename, but the selection of the saveFiledialog
of the system always show an All type(*)
.
I don't know how to resolve it.
This is a huge issue specifically in VS Code. With it defaulting to "Plain Text (.txt)" as the filetype for unknown new files, the user can't see ANY* files in the existing directory when saving to look for duplicates, naming patterns to follow, or single-click an existing file to use as a template and rename etc.
(I came here from this VS Code bug report from 6 years ago) https://github.com/microsoft/vscode/issues/28425
Surely this can be fixed within Electron, but if it can't, this feels like another desperate need for an AHK script.
Preflight Checklist
Problem Description
It is not possible to set the default filter on a save file dialog in Windows to
All Files (*.*)
. This is a nuisance because often when you want to save a file with no/unknown extension, such as.babelrc
, it appends the first filter's extension. Example: https://github.com/microsoft/vscode/issues/28425Now, I know this is intentionally not allowed, as can be seen in
shell/browser/ui/file_dialog_win#L206
:It basically picks the first filter as the default, except for the All Files one because of a supposed issue where it appends
*.*
to the file name. However, there has to be a way to do this, because other programs do (unfortunately I couldn't think of any open source one so we could look at the sources).Proposed Solution
No real ready solution in mind. Just gotta figure out how to allow it and avoid the issue. Maybe if instead of setting the default extension to
"*.*"
we set it""
when the All Files filter is used, we could get both things to work.Alternatives Considered
Verify whether the appending
*.*
to filename issue actually happens. If it doesn't, we can just cut the code out.Additional Information
Fiddle: https://gist.github.com/e9cf0de5417180669245e79b10c2f898