]> git.lyx.org Git - features.git/commitdiff
Another tweak to account for when both paths end with '/'.
authorEnrico Forestieri <forenr@lyx.org>
Mon, 25 May 2009 18:37:03 +0000 (18:37 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 25 May 2009 18:37:03 +0000 (18:37 +0000)
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

src/support/os_cygwin.cpp
src/support/os_unix.cpp
src/support/os_win32.cpp

index 79b8a16ce0f5f7214cd5a78c938e68317df2f19f..1adfa5f973b3312105da974be5715175de3a18e5 100644 (file)
@@ -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)
index 32febd978586c21b407b062fad1cd7cb5d951f02..ef13ff7f9ec69707afc6e2f8922ca3c2e5b88535 100644 (file)
@@ -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)
index 651961de77760e6f543cb66bce354f7b71d02a76..743677833a601b55aac2725e21127ec200d84afc 100644 (file)
@@ -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)