Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-7139

Directory Watcher does not match excluded sub directories on Windows


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.5.8, 5.6
    • 5.5.6
    • resource-loader
    • None
    • Windows 10
    • Yes
    • Kromeriz 119
    • 2

      When working with light modules there are many directories watched which are not relevant.
      This results in heavy DirectoryWatcher activity when doing git fetch or npm install.
      So I extended the exclusion property:


      The exclusions are applied, but are not matched by ExclusionsFilter if in subdirectories.

      Simple test case:

      public class ExclusionFilterTest {
          private Path rootPath;
          private ExclusionsFilter filter;
          public void setup() {
              this.rootPath = Paths.get("C:/magnolia-resources-root");
              final List<String> configuredExcludedDirectories = Lists.newArrayList();
              this.filter = new ExclusionsFilter(rootPath, configuredExcludedDirectories, Collections.emptyList(), Collections.emptyList());
          public void shouldNotAcceptExcludedDirectoryInRootPath() {
              final Path path = rootPath.resolve(".git");
              assertFalse("Should match .git in root", filter.apply(path));
          public void shouldNotAcceptExcludedDirectoryInSubPath() {
              final Path path = rootPath.resolve("light-module/.git");
              assertFalse("Should match .git in subdir", filter.apply(path));

      The second test fails on Windows because of the regex used in ExclusionsFilter.
      The relevant code:

      // This resolves to "light-module\.git" - notice the backslash
      Path rel = rootPath.relativize(normalizedDir);

      This does not match the regex


      It works if I modify the regex to


        Acceptance criteria

              efochr Evzen Fochr
              sbach Sven Bach
              1 Vote for this issue
              2 Start watching this issue