13
0

Add an extra test to prevent 'PBD::path_is_within()' from looping infinitely on Windows

The infinite loop would happen if the 2 supplied paths were on different Windows drives - for example if one was on drive C:\ and the other on drive E:\

I don't think this new test will be detrimental to the other platforms but if it is, we could easily separate it out with a '#ifdef PLATFORM_WINDOWS' directive.
This commit is contained in:
John Emmas 2015-02-03 11:57:38 +00:00
parent 23622f4fba
commit 2689848ed7

View File

@ -379,7 +379,7 @@ path_is_within (std::string const & haystack, std::string needle)
} }
needle = Glib::path_get_dirname (needle); needle = Glib::path_get_dirname (needle);
if (needle == "." || needle == "/") { if (needle == "." || needle == "/" || Glib::path_skip_root(needle).empty()) {
break; break;
} }
} }