]> git.lyx.org Git - features.git/commit
Add proper extension as needed in Save as and Export
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 17 Jul 2022 18:10:53 +0000 (20:10 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 25 Jul 2022 20:52:07 +0000 (22:52 +0200)
commit61d68d05bd0f2172ab9406f23dc2640e6b9ac56b
tree99dc472725eee66481d2ad91f6039cc706184f04
parentd7eecccfd4cb7e4737737f79e780f53854ba2f4c
Add proper extension as needed in Save as and Export

Introduce the new FileName method ensureExtension, which does the following:
* if the extension is already correct (in a case-insensitive way), do nothing.
* if it is not correct, add the extension to the file name.

This is different from changeExtension that will fail in a case where
the file contains dots, but not a real extension, like newfile2.1.

Use this new method in renameBuffer() and exportBufferAs().

Fixes bug #11008.
src/frontends/qt/GuiView.cpp
src/support/FileName.cpp
src/support/FileName.h