Browse Source

FIX: udarwinfswatch: the issue that when monitoring the root directory, changes in the second-level directory were also matched

rich2014 2 months ago
parent
commit
9df79dc94a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/platform/unix/darwin/udarwinfswatch.pas

+ 4 - 1
src/platform/unix/darwin/udarwinfswatch.pas

@@ -357,7 +357,10 @@ begin
   // not watchSubtree, and startsWith watchPath
   // detect if fullPath and watchPath in the same level
   fullPathDeep:= fullPath.CountChar(PathDelim);
-  watchPathDeep:= watchPath.CountChar(PathDelim)+1;
+  if watchPath = PathDelim then
+    watchPathDeep:= 1
+  else
+    watchPathDeep:= watchPath.CountChar(PathDelim)+1;
   Result:= fullPathDeep=watchPathDeep;
 end;