diff --git a/src/support/filetools.C b/src/support/filetools.C index 149448c9c8..3eaa5e5879 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -87,6 +87,8 @@ string const latex_path(string const & original_path, latex_path_dots dots) { string path = subst(original_path, "\\", "/"); + // On cygwin, we may need windows or posix style paths. + path = os::latex_path(path); path = subst(path, "~", "\\string~"); if (path.find(' ') != string::npos) { // We can't use '"' because " is sometimes active (e.g. if diff --git a/src/support/os.h b/src/support/os.h index f9517dcc39..85e97bfa85 100644 --- a/src/support/os.h +++ b/src/support/os.h @@ -47,6 +47,14 @@ std::string external_path(std::string const & p); /// Converts a host OS style path to unix style. std::string internal_path(std::string const & p); +/** + * Converts a unix style path into a form suitable for inclusion in a LaTeX + * document. + * Caution: This function handles only the OS specific part of that task. + * Never use it directly, use lyx::support::latex_path instead. + */ +std::string latex_path(std::string const & p); + /// Is the path absolute? bool is_absolute_path(std::string const & p); diff --git a/src/support/os_cygwin.C b/src/support/os_cygwin.C index 0961606f1d..dce059d40b 100644 --- a/src/support/os_cygwin.C +++ b/src/support/os_cygwin.C @@ -102,6 +102,15 @@ string internal_path(string const & p) } +string latex_path(string const & p) +{ + // We may need a posix style path or a windows style path (depending + // on cygwin_path_fix_), but we use always forward slashes, since it + // gets written into a .tex file. + return external_path(p); +} + + bool is_absolute_path(string const & p) { if (p.empty()) diff --git a/src/support/os_unix.C b/src/support/os_unix.C index 2823577313..d53b9345a5 100644 --- a/src/support/os_unix.C +++ b/src/support/os_unix.C @@ -63,6 +63,12 @@ string internal_path(string const & p) } +string latex_path(string const & p) +{ + return p; +} + + bool is_absolute_path(string const & p) { return !p.empty() && p[0] == '/'; diff --git a/src/support/os_win32.C b/src/support/os_win32.C index 462f6fe3c4..db823e5220 100644 --- a/src/support/os_win32.C +++ b/src/support/os_win32.C @@ -216,6 +216,12 @@ string internal_path(string const & p) } +string latex_path(string const & p) +{ + return p; +} + + // (Claus H.) On Win32 both Unix and Win32/DOS pathnames are used. // Therefore an absolute path could be either a pathname starting // with a slash (Unix) or a pathname starting with a drive letter diff --git a/status.14x b/status.14x index 1245ba4975..c0c3fb4b31 100644 --- a/status.14x +++ b/status.14x @@ -40,6 +40,8 @@ What's new - Convert old LyX documents with a float list at the end correctly in lyx2lyx (bug 2245). +- Set search path for included files correctly on Cygwin (bug 2409) + * User Interface: - Convert line endings for external copy/paste on OS X (bug 1955).