From 129eef17bcaf17da466832a3b5a26d91c3301279 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 21 Jun 2017 01:46:36 +0200 Subject: Do not strip file extension in CUSTOM_TYPE Windows native file save dialogs (Usually we append the proper extension afterwards, but that does only work for registered extensions and not custom extensions. The resulting behavior was that a file saved this way had usually no extension at all unless the user added one manually...) --- src/ui/dialog/filedialogimpl-win32.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/ui/dialog/filedialogimpl-win32.cpp') diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 6c8ce2620..4fb8089ee 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1586,10 +1586,15 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, if (len != 0 && udir[len - 1] == '\\') udir.erase(len - 1); // Remove the extension: remove everything past the last period found past the last slash - size_t last_slash_index = udir.find_last_of( '\\' ); - size_t last_period_index = udir.find_last_of( '.' ); - if (last_period_index > last_slash_index) { - myFilename = udir.substr(0, last_period_index ); + // (not for CUSTOM_TYPE as we can not automatically add a file extension in that case yet) + if (dialogType == CUSTOM_TYPE) { + myFilename = udir; + } else { + size_t last_slash_index = udir.find_last_of( '\\' ); + size_t last_period_index = udir.find_last_of( '.' ); + if (last_period_index > last_slash_index) { + myFilename = udir.substr(0, last_period_index ); + } } // remove one slash if double -- cgit v1.2.3