Przeglądaj źródła

Merge branch 'server-file-monitor-check' into release-3.13

Merge-request: !2556
Brad King 7 lat temu
rodzic
commit
a567f533db
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      Source/cmFileMonitor.cxx

+ 2 - 1
Source/cmFileMonitor.cxx

@@ -315,6 +315,7 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths,
   for (std::string const& p : paths) {
   for (std::string const& p : paths) {
     std::vector<std::string> pathSegments;
     std::vector<std::string> pathSegments;
     cmsys::SystemTools::SplitPath(p, pathSegments, true);
     cmsys::SystemTools::SplitPath(p, pathSegments, true);
+    const bool pathIsFile = !cmsys::SystemTools::FileIsDirectory(p);
 
 
     const size_t segmentCount = pathSegments.size();
     const size_t segmentCount = pathSegments.size();
     if (segmentCount < 2) { // Expect at least rootdir and filename
     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) {
     for (size_t i = 0; i < segmentCount; ++i) {
       assert(currentWatcher);
       assert(currentWatcher);
 
 
-      const bool fileSegment = (i == segmentCount - 1);
+      const bool fileSegment = (i == segmentCount - 1 && pathIsFile);
       const bool rootSegment = (i == 0);
       const bool rootSegment = (i == 0);
       assert(
       assert(
         !(fileSegment &&
         !(fileSegment &&