isExcludePath method

bool isExcludePath(
  1. String filePath
)

Implementation

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