From c7086206e8eb0fa1eeb243be77ff47def5217990 Mon Sep 17 00:00:00 2001 From: nift4 Date: Sat, 18 Jan 2025 17:45:43 +0100 Subject: [PATCH] ... --- app/src/main/java/org/andbootmgr/app/util/Terminal.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/andbootmgr/app/util/Terminal.kt b/app/src/main/java/org/andbootmgr/app/util/Terminal.kt index 4548ccef..2995fd2d 100644 --- a/app/src/main/java/org/andbootmgr/app/util/Terminal.kt +++ b/app/src/main/java/org/andbootmgr/app/util/Terminal.kt @@ -173,8 +173,12 @@ fun TerminalWork(logFile: String? = null, action: suspend (TerminalList) -> Unit val ctx = LocalContext.current.applicationContext LaunchedEffect(Unit) { val logDispatcher = Dispatchers.IO.limitedParallelism(1) - val log = logFile?.let { SuFileOutputStream.open(File(ctx.externalCacheDirs - .filterNotNull().firstOrNull() ?: File(Environment.getExternalStorageDirectory(), "AbmLogs"), it)) } + val log = logFile?.let { + val logDir = ctx.externalCacheDirs.filterNotNull().firstOrNull() ?: run { + File(Environment.getExternalStorageDirectory(), "AbmLogs").also { it.mkdir() } + } + SuFileOutputStream.open(File(logDir, it)) + } val s = BudgetCallbackList(CoroutineScope(logDispatcher), log) StayAliveConnection(ctx, { withContext(Dispatchers.Default) {