GUI: mux: convert QString to std::filesystem::path properly

This is in the code path used for querying the user for a file name to
save to, e.g. when browsing for the destination file in the
multiplexer or when saving an attachment in the header editor.

Fixes #3049.
This commit is contained in:
Moritz Bunkus 2021-03-05 21:46:27 +01:00
parent cdc955dafb
commit 0182e86569
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 5 additions and 1 deletions

View File

@ -32,6 +32,10 @@
copy action, no matter which keys were pressed by the users. This prevents
Windows Explorer from deleting the dragged file when the user presses shift
while dropping the file onto MKVToolNix GUI.
* MKVToolNix GUI, only on Windows: when using the file dialog for selecting a
file name to save to (e.g. when browsing for the destination file name in
the multiplexer or saving an attachment in the header editor) non-ASCII
characters in the default file name were mangled. Fixes #3049.
## Other changes

View File

@ -88,7 +88,7 @@ getSaveFileName(QWidget *parent,
QFileDialog::Options options) {
auto defaultName = sanitizeDirectory(dir, true);
if (!defaultFileName.isEmpty())
defaultName = QDir::toNativeSeparators(Q((mtx::fs::to_path(to_utf8(dir)) / to_utf8(defaultFileName)).u8string()));
defaultName = QDir::toNativeSeparators(Q((mtx::fs::to_path(to_utf8(dir)) / mtx::fs::to_path(to_utf8(defaultFileName))).u8string()));
auto result = QDir::toNativeSeparators(QFileDialog::getSaveFileName(parent, caption, defaultName, filter, selectedFilter, options & QFileDialog::DontUseCustomDirectoryIcons));