<commit_before>/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jetbrains.buildServer.nuget.agent.runner.publish.fsScanner;

import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collection;

public class RealRootDirectory implements IDirectoryEntry
  {
    @NotNull
    public String Name()
    {
      return "";
    }

    public IDirectoryEntry Parent()
    {
      return null;
    }

    @NotNull
    public IDirectoryEntry[] Subdirectories()
    {
      {
        ArrayList<IDirectoryEntry> result = new ArrayList<IDirectoryEntry>();
        if (SystemInfo.isWindows)
        {          
          for (File drive : File.listRoots())
          {
            result.add(new RealDirectoryEntry(new FileSystemPath(drive)));
          }         
        } else
        {
          for (File ch : new File("/").listFiles(new FileFilter() {
            public boolean accept(File pathname) {
              return pathname.isDirectory();
            }
          }))
          {
            result.add(new RealDirectoryEntry(new FileSystemPath(ch)));
          }
        }

        return result.toArray(new IDirectoryEntry[result.size()]);
      }
    }

    @NotNull
    public IDirectoryEntry[] Subdirectories(Collection<String> names) {
      return Subdirectories();
    }

    @NotNull
    public IFileEntry[] Files()
    {
      return new IFileEntry[0];
    }

    @NotNull
    public IFileEntry[] Files(Collection<String> names) {
      return new IFileEntry[0];
    }

    @Override
    public String toString()
    {
      return "{d:FS_META_ROOT}";
    }
  }<commit_msg>do not list root files if possible in matcher<commit_after>/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jetbrains.buildServer.nuget.agent.runner.publish.fsScanner;

import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class RealRootDirectory implements IDirectoryEntry {
  @NotNull
  public String Name() {
    return "";
  }

  public IDirectoryEntry Parent() {
    return null;
  }

  @NotNull
  public IDirectoryEntry[] Subdirectories() {
    ArrayList<IDirectoryEntry> result = new ArrayList<IDirectoryEntry>();
    if (SystemInfo.isWindows) {
      for (File drive : File.listRoots()) {
        result.add(new RealDirectoryEntry(new FileSystemPath(drive)));
      }
    } else {
      for (File ch : new File("/").listFiles(DIRECTORY_FILTER)) {
        result.add(new RealDirectoryEntry(new FileSystemPath(ch)));
      }
    }

    return result.toArray(new IDirectoryEntry[result.size()]);
  }

  @NotNull
  public IDirectoryEntry[] Subdirectories(Collection<String> names) {
    List<IDirectoryEntry> entries = new ArrayList<IDirectoryEntry>(names.size());
    for (String name : names) {
      entries.add(new RealDirectoryEntry(new FileSystemPath(new File(SystemInfo.isWindows ? name : "/" + name))));
    }
    return entries.toArray(new IDirectoryEntry[entries.size()]);
  }

  @NotNull
  public IFileEntry[] Files() {
    return new IFileEntry[0];
  }

  @NotNull
  public IFileEntry[] Files(Collection<String> names) {
    return new IFileEntry[0];
  }

  @Override
  public String toString() {
    return "{d:FS_META_ROOT}";
  }

  private final FileFilter DIRECTORY_FILTER = new FileFilter() {
    public boolean accept(File pathname) {
      return pathname.isDirectory();
    }
  };

}
{'fraction_non_alphanumeric': 0.10159404888416577, 'fraction_numerical': 0.005951115834218916, 'mean_word_length': 3.067415730337079, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7064708', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1308, 'n_words': 382}