Skip to content

Commit cd22db3

Browse files
committed
Download all possible mods when loading a game with missing mods, before notifying of problems
1 parent 5e8d3a2 commit cd22db3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

core/src/com/unciv/ui/screens/savescreens/LoadOrSaveScreen.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,20 @@ abstract class LoadOrSaveScreen(
229229
return reposFromGithub.items.firstOrNull { it.name.lowercase() == repoName }
230230
?: throw UncivShowableException("Could not find a mod named \"[$repoName]\".")
231231
}
232-
233-
for (rawName in missingMods) {
234-
val repoName = rawName.folderNameToRepoName().lowercase()
235-
val repo = getRepo(repoName)
236-
repo.downloadAndExtract()
232+
233+
val exceptions = mutableListOf<String>()
234+
for (rawModName in missingMods) {
235+
try {
236+
val repoName = rawModName.folderNameToRepoName().lowercase()
237+
val repo = getRepo(repoName)
238+
repo.downloadAndExtract()
237239
?: throw Exception("Unexpected 404 error") // downloadAndExtract returns null for 404 errors and the like -> display something!
238-
onModDownloaded(repo.name)
240+
onModDownloaded(repo.name)
241+
} catch (e: Exception) {
242+
if (e.message != null) exceptions.add(e.message!!)
243+
}
239244
}
245+
if (exceptions.isNotEmpty()) throw UncivShowableException(exceptions.joinToString("\n"))
240246
onCompleted()
241247
}
242248
}

0 commit comments

Comments
 (0)