fix recursiveFiles
This commit is contained in:
parent
5c052f5493
commit
ab984c7391
|
@ -1,7 +1,7 @@
|
|||
import Foundation
|
||||
import Path
|
||||
|
||||
public func recursiveFiles(withExtensions exts: [String], at path: Path) throws -> [Path] {
|
||||
public func recursiveFiles(withExtensions exts: [String], at path: Path) -> [Path] {
|
||||
if path.isFile {
|
||||
if exts.contains(path.extension) {
|
||||
return [path]
|
||||
|
@ -9,10 +9,14 @@ public func recursiveFiles(withExtensions exts: [String], at path: Path) throws
|
|||
return []
|
||||
} else if path.isDirectory {
|
||||
var files: [Path] = []
|
||||
do {
|
||||
for entry in try path.ls() {
|
||||
let list = try recursiveFiles(withExtensions: exts, at: entry.path)
|
||||
let list = recursiveFiles(withExtensions: exts, at: entry.path)
|
||||
files.append(contentsOf: list)
|
||||
}
|
||||
} catch {
|
||||
log("failed to path.ls: \(error.localizedDescription)", level: .warning)
|
||||
}
|
||||
return files
|
||||
}
|
||||
return []
|
||||
|
|
|
@ -16,7 +16,7 @@ public class SourceCollector {
|
|||
/// Populates the internal collections form the path source code
|
||||
/// Currently only supports Swift
|
||||
func collect() throws {
|
||||
let files: [Path] = try recursiveFiles(withExtensions: ["swift"], at: path)
|
||||
let files: [Path] = recursiveFiles(withExtensions: ["swift"], at: path)
|
||||
for file in files {
|
||||
let syntax = try SyntaxParser.parse(file.url)
|
||||
let sourceLocationConverter = SourceLocationConverter(file: file.description, tree: syntax)
|
||||
|
|
|
@ -21,7 +21,7 @@ fileprivate func main(_ arguments: [String]) -> Int32 {
|
|||
return 1
|
||||
}
|
||||
case .version:
|
||||
print("0.0.3")
|
||||
print("0.0.4")
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue