1
Liebranca
10h

Consider:

For a "Save As" dialog, you pipe into an external util from your application, passing in directory and an extension filter, something like `|` separated "Description (*.ext)".

Your code waits as the user picks. When they press OK, you get back a filename.

---

Quick poll:

If the user chose an extension/filter, but wrote the filename _without_ an extension, then what is the expected output?

[A] The filename as-is, no extension.

[B] The filename with the extension added, according to the selected filter, unless the filter was just "All Files (*.*)".

[C] "\1\0\0\0" and errno set to `EDEADLOCK`.

Comments
  • 1
    There should be a checkbox controlling whether or not the default extension is added to file names without it. The checkbox should be enabled by default and changing it should persist across uses of the dialog.

    No need to invent behavior when the decision can be punted to the user.

    To directly answer the question, I'd say B, the expected output is the filename with the extension appended.
  • 0
    [B] For me. If only to help the windows users which can't really do mimetype
  • 2
    [A] because extension filter could have more than one extension and it would be weird if the extension was added for one entry in filter but not for multiple.
    Principle of least surprise.
  • 0
    [D] Add the extension only if no extension is present in the typed file name, otherwise [A]
Add Comment