Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Ignore additional top-level directories #241

Merged
merged 2 commits into from
Apr 17, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions Sources/SwiftDoc/Module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ public final class Module {
fileManager.isReadableFile(atPath: url.path),
fileManager.fileExists(atPath: url.path, isDirectory: &isDirectory)
else {
// Skip top-level Tests directory
if isDirectory.boolValue == true,
url.lastPathComponent == "Tests",
directory.appendingPathComponent("Tests").path == url.path
{
directoryEnumerator.skipDescendants()
if isDirectory.boolValue == true {
let ignoredTopLevelDirectories: [String] = [
"node_modules",
"Packages",
"Pods",
"Resources",
"Tests"
]

for topLevelDirectory in ignoredTopLevelDirectories {
if url.lastPathComponent == topLevelDirectory,
directory.appendingPathComponent(topLevelDirectory).path == url.path
{
directoryEnumerator.skipDescendants()
}
}
}

continue
Expand Down