summaryrefslogtreecommitdiffstats
path: root/Source/cmStateDirectory.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmStateDirectory.cxx')
-rw-r--r--Source/cmStateDirectory.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index f94e714..40f694c 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -138,6 +138,23 @@ void cmStateDirectory::SetRelativePathTopBinary(const char* dir)
this->DirectoryState->RelativePathTopBinary = dir;
}
+bool cmStateDirectory::ContainsBoth(std::string const& local_path,
+ std::string const& remote_path) const
+{
+ auto PathEqOrSubDir = [](std::string const& a, std::string const& b) {
+ return (cmSystemTools::ComparePath(a, b) ||
+ cmSystemTools::IsSubDirectory(a, b));
+ };
+
+ bool bothInBinary = PathEqOrSubDir(local_path, GetRelativePathTopBinary()) &&
+ PathEqOrSubDir(remote_path, GetRelativePathTopBinary());
+
+ bool bothInSource = PathEqOrSubDir(local_path, GetRelativePathTopSource()) &&
+ PathEqOrSubDir(remote_path, GetRelativePathTopSource());
+
+ return bothInBinary || bothInSource;
+}
+
cmStateDirectory::cmStateDirectory(
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
const cmStateSnapshot& snapshot)