From: Enrico Forestieri Date: Mon, 25 May 2009 18:37:03 +0000 (+0000) Subject: Another tweak to account for when both paths end with '/'. X-Git-Tag: 2.0.0~6447 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=70351330a03efd3a24edc5faaa7d1fa9d29da8ca;p=features.git Another tweak to account for when both paths end with '/'. The problem here is making sure that path_prefix_is() behaves exactly as would a case insensitive prefixIs(). Anyway, this is still better than trying to fix the semantics of common_path(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29846 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 79b8a16ce0..1adfa5f973 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -181,7 +181,7 @@ bool path_prefix_is(string & path, string const & pre, path_case how) docstring::size_type const p2_len = p2.length(); docstring::size_type common_len = common_path(p1, p2); - if (p2[p2_len - 1] == '/') + if (p2[p2_len - 1] == '/' && p1_len != p2_len) ++common_len; if (common_len != p2_len) diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index 32febd9785..ef13ff7f9e 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -94,7 +94,7 @@ bool path_prefix_is(string & path, string const & pre, path_case how) docstring::size_type const p2_len = p2.length(); docstring::size_type common_len = common_path(p1, p2); - if (p2[p2_len - 1] == '/') + if (p2[p2_len - 1] == '/' && p1_len != p2_len) ++common_len; if (common_len != p2_len) diff --git a/src/support/os_win32.cpp b/src/support/os_win32.cpp index 651961de77..743677833a 100644 --- a/src/support/os_win32.cpp +++ b/src/support/os_win32.cpp @@ -212,7 +212,7 @@ bool path_prefix_is(string & path, string const & pre, path_case how) docstring::size_type const p2_len = p2.length(); docstring::size_type common_len = common_path(p1, p2); - if (p2[p2_len - 1] == '/') + if (p2[p2_len - 1] == '/' && p1_len != p2_len) ++common_len; if (common_len != p2_len)