     }
     
     private func modulify(_ path: AbsolutePath, name: String, isTest: Bool) throws -> Module {
-        let walked = try walk(path, recursing: shouldConsiderDirectory).map{ $0 }
+        let walked = try walk(path, fileSystem: fileSystem, recursing: shouldConsiderDirectory).map{ $0 }
         
         let cSources = walked.filter{ isValidSource($0, validExtensions: SupportedLanguageExtension.cFamilyExtensions) }
         let swiftSources = walked.filter{ isValidSource($0, validExtensions: SupportedLanguageExtension.swiftExtensions) }

        let srcroot = try sourceRoot()

        if srcroot != packagePath {
            let invalidRootFiles = try walk(packagePath, recursively: false).filter(isValidSource)
            guard invalidRootFiles.isEmpty else {
                throw ModuleError.invalidLayout(.invalidLayout(invalidRootFiles.map{ $0.asString }))
            }
        }

        let maybeModules = try walk(srcroot, recursively: false).filter(shouldConsiderDirectory)

        if maybeModules.count == 1 && maybeModules[0] != srcroot {
            let invalidModuleFiles = try walk(srcroot, recursively: false).filter(isValidSource)
            guard invalidModuleFiles.isEmpty else {
                throw ModuleError.invalidLayout(.invalidLayout(invalidModuleFiles.map{ $0.asString }))
            }

        case 0:
            return packagePath
        case 1:
            return packagePath.appending(component: viableRoots[0])
        default:
            // eg. there is a `Sources' AND a `src'
            throw ModuleError.invalidLayout(.multipleSourceRoots(viableRoots.map{ packagePath.appending(component: $0).asString }))
        }
    }

    /// Collects the modules which are defined by a package.
    private func constructModules() throws -> [Module] {
        let moduleMapPath = packagePath.appending("module.modulemap")
        if fileSystem.isFile(moduleMapPath) {
            let sources = Sources(paths: [moduleMapPath], root: packagePath)
            return [try CModule(name: manifest.name, sources: sources, path: packagePath, pkgConfig: pkgConfigPath, providers: manifest.package.providers)]
        }
