     //          then migrate by reinstalling the KMP.
     var matched: [Resource] = []
 
-    localPackages.forEach { package in
+    localPackages.forEach { (package, kmpFile) in
       let packageMatches: [Resource] = resources.compactMap { resource in
         if let possibleMatch = package.findResource(withID: resource.typedFullID) {
           if possibleMatch.version == resource.version {

        _ resources: [Resource]) -> [Resource]
        where Resource: KMPInitializableLanguageResource,
              Resource == Resource.Metadata.LanguageResourceType {
    // Step 1 - analyze all locally-cached KMPs for possible resource sources.
    var allLocalPackages: [KeymanPackage] = []
    do {
      let cachedKMPsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
      let files = try FileManager.default.contentsOfDirectory(atPath: cachedKMPsDirectory.path)


      allLocalPackages = kmpFiles.compactMap { file in
        let filePath = cachedKMPsDirectory.appendingPathComponent(file)
        return (ResourceFileManager.shared.getPackageInfo(for: filePath)!, filePath)
      }
    } catch {
      log.error("Could not check contents of Documents directory for resource-migration assist")
    }

    // Filters out Packages that don't contain the matching resource type.
    let localPackages: [(Package, URL)] = allLocalPackages.compactMap { tuple in
      if let package = tuple.0 as? Package {
        return (package, tuple.1)
      } else {
        return nil
      }
    }

