Provide TMPDIR for boot image repacking (#2458)

/data/local/tmp is never writable for normal apps, why previously it
works is that Rust's temp_dir() gets path from env, and since A13,
TMPDIR is set to app's cache dir. This is not the case for A12, so it
breaks. Fix it by set TMPDIR ourselves.
This commit is contained in:
Wang Han
2025-02-21 11:09:02 +08:00
committed by GitHub
parent 107a34789e
commit f33b12cd52

View File

@@ -1,6 +1,7 @@
package me.weishu.kernelsu package me.weishu.kernelsu
import android.app.Application import android.app.Application
import android.system.Os
import coil.Coil import coil.Coil
import coil.ImageLoader import coil.ImageLoader
import me.zhanghai.android.appiconloader.coil.AppIconFetcher import me.zhanghai.android.appiconloader.coil.AppIconFetcher
@@ -30,6 +31,9 @@ class KernelSUApplication : Application() {
if (!webroot.exists()) { if (!webroot.exists()) {
webroot.mkdir() webroot.mkdir()
} }
// Provide working env for rust's temp_dir()
Os.setenv("TMPDIR", cacheDir.absolutePath, true)
} }