mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Patch from Enrico:
In src/support/os_cygwin.C path styles are converted (when needed) from one style to another. I discovered a couple of cases in which an unnecessary conversion takes place. The default output path style in external_path is windows because this function is also used when adding fonts though a native Windows API call. However, this call is not made in an X11 build, so it is not necessary that the output path style is windows. Log: Small fixes for cygwin. * os_cygwin.C (is_windows_path): avoid unnecessary conversion when path is relative (convert_path_list): avoid unnecessary conversion when path list is empty (external_path): for an X11 build it is not necessary that the output path style is windows git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14859 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
86b063d2da
commit
02f51e1820
@ -55,8 +55,7 @@ bool is_posix_path(string const & p)
|
|||||||
|
|
||||||
bool is_windows_path(string const & p)
|
bool is_windows_path(string const & p)
|
||||||
{
|
{
|
||||||
return p.empty() ||
|
return p.empty() || (!contains(p, '\\') && p[0] != '/');
|
||||||
(!contains(p, '\\') && (p.length() <= 1 || p[1] == ':'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,6 +86,9 @@ string convert_path(string const & p, PathStyle const & target)
|
|||||||
|
|
||||||
string convert_path_list(string const & p, PathStyle const & target)
|
string convert_path_list(string const & p, PathStyle const & target)
|
||||||
{
|
{
|
||||||
|
if (p.empty())
|
||||||
|
return p;
|
||||||
|
|
||||||
char const * const pc = p.c_str();
|
char const * const pc = p.c_str();
|
||||||
PathStyle const actual = cygwin_posix_path_list_p(pc) ? posix : windows;
|
PathStyle const actual = cygwin_posix_path_list_p(pc) ? posix : windows;
|
||||||
|
|
||||||
@ -186,7 +188,11 @@ string::size_type common_path(string const & p1, string const & p2)
|
|||||||
|
|
||||||
string external_path(string const & p)
|
string external_path(string const & p)
|
||||||
{
|
{
|
||||||
|
#ifdef X_DISPLAY_MISSING
|
||||||
return convert_path(p, PathStyle(windows));
|
return convert_path(p, PathStyle(windows));
|
||||||
|
#else
|
||||||
|
return convert_path(p, PathStyle(posix));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user