]> git.lyx.org Git - lyx.git/commitdiff
write output to infile.lyx
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 25 Jul 2005 16:27:23 +0000 (16:27 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 25 Jul 2005 16:27:23 +0000 (16:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10354 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/ChangeLog
src/tex2lyx/tex2lyx.C

index 55b51b3a90bc87a1e093cdbf37c39aaed54ba14f..190ab153aa237c00d0e12bf833c843c315eb3191 100644 (file)
@@ -1,6 +1,7 @@
 2005-07-25  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * tex2lyx.C (main): allow specification of output file name
+       * tex2lyx.C (main): write to infile.lyx if no output file is given
 
 2005-07-18  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
index 29b4bd5d16859eb13fa4fc603bad1ed8cc4bdd3c..22c13660d118296d77d11a5f9210847f51d64bb8 100644 (file)
@@ -52,6 +52,7 @@ using std::string;
 using std::vector;
 using std::map;
 
+using lyx::support::ChangeExtension;
 using lyx::support::isStrUnsignedInt;
 using lyx::support::ltrim;
 using lyx::support::MakeAbsPath;
@@ -495,8 +496,12 @@ int main(int argc, char * argv[])
        // file name (the latter is optional).
        string const infilename = MakeAbsPath(argv[1]);
        string outfilename;
-       if (argc > 2)
-               outfilename = MakeAbsPath(argv[2]);
+       if (argc > 2) {
+               outfilename = argv[2];
+               if (outfilename != "-")
+                       outfilename = MakeAbsPath(argv[2]);
+       } else
+               outfilename = ChangeExtension(infilename, ".lyx");
 
        string const system_syntaxfile = lyx::support::LibFileSearch("", "syntax.default");
        if (system_syntaxfile.empty()) {
@@ -510,7 +515,7 @@ int main(int argc, char * argv[])
        masterFilePath = OnlyPath(infilename);
        parentFilePath = masterFilePath;
 
-       if (outfilename.empty() || outfilename == "-") {
+       if (outfilename == "-") {
                if (tex2lyx(infilename, cout))
                        return EXIT_SUCCESS;
                else