write output to infile.lyx

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10354 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2005-07-25 16:27:23 +00:00
parent 8ce79c6fd3
commit db92c134c2
2 changed files with 9 additions and 3 deletions

View 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>

View 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