From 80c41f2fd5dd0c2c803c6965b75a9c138fb83470 Mon Sep 17 00:00:00 2001 From: Wang Han <416810799@qq.com> Date: Fri, 21 Feb 2025 11:09:02 +0800 Subject: [PATCH] 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. --- .../src/main/java/me/weishu/kernelsu/KernelSUApplication.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/KernelSUApplication.kt b/manager/app/src/main/java/me/weishu/kernelsu/KernelSUApplication.kt index 0503b42f0f43..3b07b99cb0cf 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/KernelSUApplication.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/KernelSUApplication.kt @@ -1,6 +1,7 @@ package me.weishu.kernelsu import android.app.Application +import android.system.Os import coil.Coil import coil.ImageLoader import me.zhanghai.android.appiconloader.coil.AppIconFetcher @@ -30,7 +31,10 @@ class KernelSUApplication : Application() { if (!webroot.exists()) { webroot.mkdir() } + + // Provide working env for rust's temp_dir() + Os.setenv("TMPDIR", cacheDir.absolutePath, true) } -} \ No newline at end of file +}