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 rifsxd
parent 74171a2930
commit 36111f4b89

View File

@@ -1,6 +1,7 @@
package com.rifsxd.ksunext
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)
}
}
}