Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: > > >>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes: > > Georg> Now I don't like either anymore. The problem of both fixes is > Georg> that they use a trailing '/' as flag whether external_path() is > Georg> needed or not. This will strike back sooner or later. > > Sure, this is not good. Is the problem that latex_path() needs > different syntax depending on whether the file name is used inside a > .tex file or as command argument? > > What is the problem exactly?
The problem is that I have not a full grasp of the overall code and don't want introduce changes without fully knowing the consequences. I repeat, my idea is of only fixing what is broken, making changes that I fully understand. As a problem arised with [EMAIL PROTECTED], I tried to fix only that case. As regards the trailing '/', I think this is not a problem, as there is only one place in the code where latex_path() is called for generating the argument of [EMAIL PROTECTED] It is in src/buffer.C, so a patch in which I am confident is along these lines: --- src/buffer.C (revision 13450) +++ src/buffer.C (working copy) @@ -875,7 +876,9 @@ void Buffer::makeLaTeXFile(ostream & os, texrow().newline(); } if (!original_path.empty()) { - string const inputpath = latex_path(original_path); + // A trailing slash is used as a flag for latex_path + // which will return an unslashed path. + string const inputpath = latex_path(original_path + "/") ; os << "\\makeatletter\n" << "[EMAIL PROTECTED]" << inputpath << "/}}\n" and then in latex_path(), either: --- src/support/filetools.C (revision 13450) +++ src/support/filetools.C (working copy) @@ -87,6 +87,11 @@ string const latex_path(string const & o latex_path_dots dots) { string path = subst(original_path, "\\", "/"); + if (suffixIs(path, '/')) { + path = rtrim(path, "/"); + if (os::cygwin_path_fix()) + path = os::external_path(path); + } path = subst(path, "~", "\\string~"); if (path.find(' ') != string::npos) { // We can't use '"' because " is sometimes active (e.g. if alongthe lines of the first patch, or: --- src/support/filetools.C (revision 13450) +++ src/support/filetools.C (working copy) @@ -86,7 +86,15 @@ string const latex_path(string const & o latex_path_extension extension, latex_path_dots dots) { - string path = subst(original_path, "\\", "/"); + string path; + + if (suffixIs(original_path, '/')) { + path = rtrim(path, "/"); + // The call to os::external_path is needed for Cygwin. + path = subst(os::external_path(original_path), "\\", "/"); + } else + path = subst(original_path, "\\", "/"); + path = subst(path, "~", "\\string~"); if (path.find(' ') != string::npos) { // We can't use '"' because " is sometimes active (e.g. if along the lines of the second patch. Both approaches work and are robust because the trailing '/' is anyway added. Please, tell me what to do. I do not feel confortable in unconditionally call external_path (I don't want to fix what is not broken). -- Enrico