Georg Baum <[EMAIL PROTECTED]> writes:
>
> Jean-Pierre Chrétien wrote:
>
> This is intended behaviour. After all, we don't know if an already
> existing .lyx file has anything to do with the .tex file. LaTeX would use
> the .tex file, so tex2lyx uses it, too.
I see.
> In general, some informational messages would be nice, so a patch is welcome
> (but use "Overwriting" instead of "Updating", since this is what really
> happens.
Here is my suggestion:
- enumerate absolute path of \included ou \inputted files converted to lyx
(with indication of creation or overwrite).
- warn about inset of original .tex file if existing lyx file (this may be
very misleading).
I changed my script, but I understand that it will soon be useless if
tex2lyx and ly2lyx are shipped with 1.3.6
--
Jean-Pierre
cat <<EOF
*** src/tex2lyx/tex2lyx.C.orig Mon May 30 15:52:19 2005
--- src/tex2lyx/tex2lyx.C Mon May 30 15:34:19 2005
***************
*** 407,412 ****
--- 407,418 ----
cerr << "Not overwriting existing file " << outfilename << "\n";
return false;
}
+ else if (overwrite_files && IsFileReadable(outfilename)) {
+ cerr << "Overwriting existing file " << outfilename << "\n";
+ }
+ else {
+ cerr << "Creating file " << outfilename << "\n";
+ }
ofstream os(outfilename.c_str());
if (!os.good()) {
cerr << "Could not open output file \"" << outfilename
***************
*** 446,451 ****
--- 452,458 ----
if (!syntaxfile.empty())
read_syntaxfile(syntaxfile);
+
string const infilename = MakeAbsPath(argv[1]);
masterFilePath = OnlyPath(infilename);
parentFilePath = masterFilePath;
*** src/tex2lyx/text.C.orig Mon May 30 15:52:00 2005
--- src/tex2lyx/text.C Mon May 30 15:47:29 2005
***************
*** 32,37 ****
--- 32,38 ----
using lyx::support::ChangeExtension;
using lyx::support::MakeAbsPath;
using lyx::support::MakeRelPath;
+ using lyx::support::IsFileReadable;
using lyx::support::rtrim;
using lyx::support::suffixIs;
using lyx::support::contains;
***************
*** 1907,1914 ****
os << name << '{' << lyxname << "}\n";
} else {
os << name << '{' << filename << "}\n";
! }
! } else {
cerr << "Warning: Could not find included file
'"
<< filename << "'." << endl;
os << name << '{' << filename << "}\n";
--- 1908,1919 ----
os << name << '{' << lyxname << "}\n";
} else {
os << name << '{' << filename << "}\n";
! if (IsFileReadable(lyxname)) {
! cerr << "Existing " << lyxname
! << ", insetting " << filename << "\n";
! }
! }
! } else {
cerr << "Warning: Could not find included file
'"
<< filename << "'." << endl;
os << name << '{' << filename << "}\n";
EOF