mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-12 01:09:47 -06:00
server: Fix assertion failure on directory paths in file monitor
Fixes: #18532
This commit is contained in:
committed by
Brad King
parent
3e5548784d
commit
eb52529ff4
@@ -315,6 +315,7 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths,
|
||||
for (std::string const& p : paths) {
|
||||
std::vector<std::string> pathSegments;
|
||||
cmsys::SystemTools::SplitPath(p, pathSegments, true);
|
||||
const bool pathIsFile = !cmsys::SystemTools::FileIsDirectory(p);
|
||||
|
||||
const size_t segmentCount = pathSegments.size();
|
||||
if (segmentCount < 2) { // Expect at least rootdir and filename
|
||||
@@ -324,7 +325,7 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths,
|
||||
for (size_t i = 0; i < segmentCount; ++i) {
|
||||
assert(currentWatcher);
|
||||
|
||||
const bool fileSegment = (i == segmentCount - 1);
|
||||
const bool fileSegment = (i == segmentCount - 1 && pathIsFile);
|
||||
const bool rootSegment = (i == 0);
|
||||
assert(
|
||||
!(fileSegment &&
|
||||
|
||||
Reference in New Issue
Block a user