fix: a failed Steam client download ends the session with a message instead of silently (#997)

This commit is contained in:
Resul Övür authored and GitHub committed 2026-10-21 00:56:05 -04:00
1 parent 152b961940
commit abeaf7ccb6
38 files changed
+267 -9

No files matched your search

@@ -0,0 +1,28 @@
package com.droiddeck.launcher.session
class SteamClientSetupFailure(val curlError: String?) {
val download get() = curlError != null
companion object {
const val MARKER = "== steam: the Steam client could not be set up"
private const val STEP = "checking the Steam client"
private const val X64_STEP = "checking the x86-64 Steam client"
private val CURL_ERROR = Regex("""curl: \(\d+\).*""")
fun find(lines: Sequence<String>): SteamClientSetupFailure? {
var curlError: String? = null
var found: SteamClientSetupFailure? = null
lines.forEach { line ->
when {
line.contains(STEP) || line.contains(X64_STEP) -> {
curlError = null
found = null
}
line.contains(MARKER) -> found = SteamClientSetupFailure(curlError)
else -> CURL_ERROR.find(line)?.let { curlError = it.value.trim() }
}
}
return found
}
}
}