Skip to content

Commit 7fd39bc

Browse files
committed
ensure we have proper place for logs
1 parent 41582c9 commit 7fd39bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/src/main/java/org/andbootmgr/app/util/Terminal.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.andbootmgr.app.util
22

3+
import android.os.Environment
34
import android.util.Log
45
import androidx.compose.foundation.horizontalScroll
56
import androidx.compose.foundation.layout.Column
@@ -172,7 +173,8 @@ fun TerminalWork(logFile: String? = null, action: suspend (TerminalList) -> Unit
172173
val ctx = LocalContext.current.applicationContext
173174
LaunchedEffect(Unit) {
174175
val logDispatcher = Dispatchers.IO.limitedParallelism(1)
175-
val log = logFile?.let { SuFileOutputStream.open(File(ctx.externalCacheDirs.first(), it)) }
176+
val log = logFile?.let { SuFileOutputStream.open(File(ctx.externalCacheDirs
177+
.filterNotNull().firstOrNull() ?: File(Environment.getExternalStorageDirectory(), "AbmLogs"), it)) }
176178
val s = BudgetCallbackList(CoroutineScope(logDispatcher), log)
177179
StayAliveConnection(ctx, {
178180
withContext(Dispatchers.Default) {

0 commit comments

Comments
 (0)