mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-23 13:10:54 +07:00
Resolved #6445 - problems in hosting Unciv server
Solution from https://stackoverflow.com/questions/56533497/how-to-replace-blocking-code-for-reading-bytes-in-kotlin
This commit is contained in:
parent
6b99b11179
commit
8b5665a73f
@ -248,7 +248,7 @@ class Nation : RulesetObject() {
|
||||
// This does not use the auto-linking FormattedLine(Unique) for two reasons:
|
||||
// would look a little chaotic as unit uniques unlike most uniques are a HashSet and thus do not preserve order
|
||||
// No .copy() factory on FormattedLine and no FormattedLine(Unique, all other val's) constructor either
|
||||
if (unit.replacementTextForUniques.isNotEmpty()){
|
||||
if (unit.replacementTextForUniques.isNotEmpty()) {
|
||||
yield(FormattedLine(unit.replacementTextForUniques))
|
||||
}
|
||||
else for (unique in unit.uniqueObjects.filterNot { it.text in originalUnit.uniques || it.hasFlag(UniqueFlag.HiddenToUsers) }) {
|
||||
|
@ -48,10 +48,10 @@ private class UncivServerRunner : CliktCommand() {
|
||||
put("/files/{fileName}") {
|
||||
val fileName = call.parameters["fileName"] ?: throw Exception("No fileName!")
|
||||
withContext(Dispatchers.IO) {
|
||||
val recievedBytes =
|
||||
call.request.receiveChannel().toInputStream().readAllBytes()
|
||||
val textString = String(recievedBytes)
|
||||
println("Recieved text: $textString")
|
||||
val receivedBytes =
|
||||
call.request.receiveChannel().toInputStream().readBytes()
|
||||
val textString = String(receivedBytes)
|
||||
println("Received text: $textString")
|
||||
File(fileFolderName, fileName).writeText(textString)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user