summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/filedialogimpl-win32.cpp
diff options
context:
space:
mode:
authorEduard Braun <Eduard.Braun2@gmx.de>2017-06-20 23:46:36 +0000
committerEduard Braun <Eduard.Braun2@gmx.de>2017-06-20 23:46:36 +0000
commit129eef17bcaf17da466832a3b5a26d91c3301279 (patch)
treeb5a38efb472834d4fb56e83baafa837cdbce52ef /src/ui/dialog/filedialogimpl-win32.cpp
parentFix a crash in CUSTOM_TYPE Windows native file save dialogs (diff)
downloadinkscape-129eef17bcaf17da466832a3b5a26d91c3301279.tar.gz
inkscape-129eef17bcaf17da466832a3b5a26d91c3301279.zip
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...)
Diffstat (limited to 'src/ui/dialog/filedialogimpl-win32.cpp')
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp13
1 files changed, 9 insertions, 4 deletions
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