Automatically add extension for save file
Hi is there the chance to add the option to automatically add the extesion for the save file dialog? I have looked throught the API but I am not able to find if this is already implemented or not.
Alberto
I'm sure you figured this out quickly, so I'm writing this just for posterity. The result of the file Save/Open dialogs are file paths. So, if you want to automatically add an extension to filenames, that's as simple as checking the end of the received filename for the extension, and append it, if it doesn't already have it.
First of all, thanks @samhocevar for this library. Very useful.
As you said, it's straighforward to add the extension to the file name. However, there are two issues:
-
We can't tell if the user chose not to add an extension on purpose or not.
-
The file overwrite dialog. Let's say that a file
test.datalready exists. Now if the user choosestest, the overwite warning dialog is not shown even though the file will actually get overwritten after we add the.datextention. -
If multiple extentions are possible (e.g. there is more than one file exention filter). Because the extenion is not added to path, we have no idea which of the possilbe extentions to use.
I can look into this and do a pull request if you wish?