 	try arguments.parse()
 	DirectoryPath.current = projectdir.value
 
-	let testfiles = runAsync("find", "Tests", "-name", "*.swift").stdout.list().map(FilePath.init(_:))
+	let testfiles = try Directory(open: "Tests").files("*/*.swift", recursive: true)
 	guard !testfiles.isEmpty else { exit(errormessage: "Could not find any .swift files under \"Tests/*/\".") }
 	let classnames = try testfiles.flatMap(addAllTests)
 	try makeLinuxMainDotSwift(classnames)


let arguments = Moderator()
let overwrite = arguments.add(.option("o","overwrite", description: "Replace Tests/LinuxMain.swift if it already exists."))
let dryrun = arguments.add(.option("d","dryrun", description: "Show what will happen without changing any files."))
let projectdir = arguments.add(Argument<String?>
	.singleArgument(name: "directory", description: "The project root directory")
	.default("./")

func addAllTests(tofile path: FilePath) throws -> [String] {
	let file = try path.edit()
	let testclasses = getTestClasses(file)
	guard !testclasses.isEmpty else { print("  Tests/\(path): Skipping, no test classes found."); return [] }

	testclasses.map(makeAllTests).forEach(file.write)
	let names = testclasses.map {$0.classname}
	print("+ Tests/\(path): Added 'allTests' to \(names.joined(separator: ", ")).")
	return names
}

func makeLinuxMainDotSwift(_ classnames: [String]) throws {
