Georg Baum <[EMAIL PROTECTED]> writes:

> I think that you can safely call it unconditionally. I looked it up, and
> latex_path() is only called on filenames that are written to .tex files. I
> would be very surprised if a TeX compiler exists on windows that needs win
> style paths in \inputa <at> path but posix style paths in \includegraphics or
> \input.
> To be sure you could make a simple test: Call external_path()
> unconditionally, and try to view a document that contains a graphics inset,
> and two include insets, one with \input and one with \include. All files
> should be entered with absolute names.
> If my theory is right then running latex on the exported .tex file will work
> with the unconditional fix and fail with the conditional one.
> The absolute names are necessary to get slashes in the name, and running
> latex on the exported .tex file is necessary because LyX uses always
> relative paths for running latex internally.

Your theory is right and I wasn't fearless enough, not having the time
to study the code. So, the attached is apparently the right fix. While
testing this patch I run up against another bug.

1) File->New
2) Insert->File->Child Document   (say we input ~/test.tex)
3) File->Export->LaTeX

LyX pops up a dialog telling me that ~/test.tex already exists and
asking for overwriting it. I say yes, overwrite it, but newfile1.lyx
is normally created and ~/test.tex is not overwritten. This is
independent from the fact that the buffer has been given a name or not.
This also happens on Solaris and I could not find a similar bug
reported in bugzilla.
 
> PS: You might want to have a look at the cygwin version of external_path().
> It contains unreachable code.

Uhm, I don't think so. The code after "else return p;" gets executed when
the previous if() clause is satisfied.

Many thanks for your helpful and appreciated comments.

-- 
Enrico


Index: src/support/filetools.C
===================================================================
--- src/support/filetools.C     (revision 13463)
+++ src/support/filetools.C     (working copy)
@@ -86,7 +86,9 @@ string const latex_path(string const & o
                latex_path_extension extension,
                latex_path_dots dots)
 {
-       string path = subst(original_path, "\\", "/");
+       // The call to os::external_path is only needed for Cygwin.
+       string path = subst(os::external_path(original_path), "\\", "/");
+       path = rtrim(path, "/");
        path = subst(path, "~", "\\string~");
        if (path.find(' ') != string::npos) {
                // We can't use '"' because " is sometimes active (e.g. if


Reply via email to