isIncludePath method

bool isIncludePath(
  1. String filePath
)

Implementation

bool isIncludePath(String filePath) {
  List<String> includePaths = config.includePaths ?? [];
  includePaths = includePaths
      .map((e) => e.split('/').where((part) => part.isNotEmpty).join('/'))
      .toList(); // 清理路径,移除多余的斜杠
  if (includePaths.isEmpty) {
    // 如果没有填写,默认包含
    return true;
  }
  if (includePaths.contains(filePath)) {
    // 文件包含
    return true;
  } else {
    // 判断目录
    final l = filePath.split("/");
    l.removeLast();
    String fileDir = l.join("/");
    if (includePaths.contains(fileDir)) {
      return true;
    }
    return false;
  }
}