Fix temp dir on Android 10 or below (#1250)
Co-authored-by: Ylarod <me@ylarod.cn>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user