summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-01-02 13:32:26 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2012-01-02 13:32:26 +0000
commit38567af775cbc42af4bbfdd7eefc98e8b757bf3d (patch)
treebca0cd07630fa8ebc114c7beeea90cab72e71ef1
parentFix for bugs #902054, #884368 and #909958 (minimum widget size) by John Smith. (diff)
downloadinkscape-38567af775cbc42af4bbfdd7eefc98e8b757bf3d.tar.gz
inkscape-38567af775cbc42af4bbfdd7eefc98e8b757bf3d.zip
win32 saving: clean up filename handling on opening save dialog
(bzr r10820)
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 4ed963148..56929912d 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -1591,9 +1591,18 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent,
// leaving a trailing backslash on the directory name leads to the infamous
// double-directory bug on win32
if (len != 0 && udir[len - 1] == '\\') udir.erase(len - 1);
- myFilename = udir.substr(0, udir.find_last_of( '.' ) ); // this removes the extension, or actually, removes everything past the last dot (hopefully this is what most people want)
- if (1 + myFilename.find("\\\\",2)) // remove one slash if double
+
+ // 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 );
+ }
+
+ // remove one slash if double
+ if (1 + myFilename.find("\\\\",2)) {
myFilename.replace(myFilename.find("\\\\",2), 1, "");
+ }
}
}