summaryrefslogtreecommitdiff
path: root/libs/pbd/file_utils.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2015-02-03 11:57:38 +0000
committerJohn Emmas <johne53@tiscali.co.uk>2015-02-03 11:57:38 +0000
commit2689848ed796dfc070da96c215e31add06577226 (patch)
treec8d4f1c00070339f1bb9499bf5825d0d8e8e8438 /libs/pbd/file_utils.cc
parent23622f4fba03be848ffeb80a98d340d555da7a74 (diff)
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.
Diffstat (limited to 'libs/pbd/file_utils.cc')
-rw-r--r--libs/pbd/file_utils.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc
index f8ab326c5b..9523fdd6bd 100644
--- a/libs/pbd/file_utils.cc
+++ b/libs/pbd/file_utils.cc
@@ -379,7 +379,7 @@ path_is_within (std::string const & haystack, std::string needle)
}
needle = Glib::path_get_dirname (needle);
- if (needle == "." || needle == "/") {
+ if (needle == "." || needle == "/" || Glib::path_skip_root(needle).empty()) {
break;
}
}