[LyX/master] Support suffix-less tex file input in tex2lyx (#12340)
Juergen Spitzmueller
spitz at lyx.org
Wed Dec 28 11:37:52 UTC 2022
commit 992e3aec88766cc6ce5332cdcd5b8872c4dcdf9d
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Wed Dec 28 13:34:23 2022 +0100
Support suffix-less tex file input in tex2lyx (#12340)
---
src/tex2lyx/tex2lyx.cpp | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 0d588d2..308d5b1 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -979,9 +979,16 @@ bool tex2lyx(idocstream & is, ostream & os, string const & encoding,
/// convert TeX from \p infilename to LyX and write it to \p os
-bool tex2lyx(FileName const & infilename, ostream & os, string encoding,
+bool tex2lyx(FileName const & infilename_in, ostream & os, string encoding,
string const & outfiledir)
{
+ FileName infilename = infilename_in;
+ // Like TeX, we consider files without extensions as *.tex files
+ // and append the extension if the file without ext does not exist
+ // (#12340)
+ if (!infilename.exists() && infilename.extension().empty())
+ infilename.changeExtension("tex");
+
// Set a sensible default encoding.
// This is used until an encoding command is found.
// For child documents use the encoding of the master, else try to
More information about the lyx-cvs
mailing list