Fix temp dir on Android 10 or below (#1250)

Co-authored-by: Ylarod <me@ylarod.cn>
This commit is contained in:
Nullptr
2024-01-05 14:41:33 +08:00
committed by GitHub
parent 01711b4114
commit 52f5727875
4 changed files with 22 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ use std::{
path::Path,
};
use crate::defs;
use std::fs::metadata;
#[allow(unused_imports)]
use std::fs::{set_permissions, Permissions};
#[cfg(unix)]
@@ -163,3 +165,13 @@ pub fn umask(_mask: u32) {
pub fn has_magisk() -> bool {
which::which("magisk").is_ok()
}
pub fn get_tmp_path() -> &'static str {
if metadata(defs::TEMP_DIR_LEGACY).is_ok() {
return defs::TEMP_DIR_LEGACY;
}
if metadata(defs::TEMP_DIR).is_ok() {
return defs::TEMP_DIR;
}
""
}