From 24d11e66b47e167413aabd308b381d35dcdb5447 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Fri, 14 Oct 2022 10:53:03 +0200 Subject: [PATCH] Utils: Fix FilePath::isChildOf Previously isChildOf would only look at the path. But if the two paths are from different devices it would mistakenly return true if the paths were similar. Change-Id: Icdb1aebe61167183ec85fa56ae0708681a59a9f8 Reviewed-by: hjk --- src/libs/utils/filepath.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index f5e86d922d0..dbcca7b6b0b 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -908,6 +908,8 @@ FilePath FilePath::operator+(const QString &s) const /// \returns whether FilePath is a child of \a s bool FilePath::isChildOf(const FilePath &s) const { + if (!s.isSameDevice(*this)) + return false; if (s.isEmpty()) return false; if (!path().startsWith(s.path(), caseSensitivity()))