Revert "ksud_magic: probe for more workdir candidates (#221)"

This reverts commit a68b4fe7e0.
This commit is contained in:
rifsxd
2025-03-11 23:31:30 +06:00
parent d8944d641c
commit d79ea50c6e
4 changed files with 8 additions and 38 deletions
+1 -33
View File
@@ -1,6 +1,6 @@
use anyhow::{Context, Error, Ok, Result, bail};
use std::{
fs::{self, create_dir_all, remove_file, write, File, OpenOptions},
fs::{create_dir_all, remove_file, write, File, OpenOptions},
io::{
ErrorKind::{AlreadyExists, NotFound},
Write,
@@ -177,38 +177,6 @@ pub fn has_magisk() -> bool {
which::which("magisk").is_ok()
}
fn is_ok_empty(dir: &str) -> bool {
use std::result::Result::Ok;
match fs::read_dir(dir) {
Ok(mut entries) => entries.next().is_none(),
Err(_) => false,
}
}
pub fn get_tmp_path() -> String {
let dirs = [
"/debug_ramdisk",
"/patch_hw",
"/oem",
"/root",
"/sbin",
];
// find empty directory
for dir in dirs {
if is_ok_empty(dir) {
return dir.to_string();
}
}
"".to_string()
}
pub fn get_work_dir() -> String {
let tmp_path = get_tmp_path();
format!("{}/workdir/", tmp_path)
}
#[cfg(target_os = "android")]
fn link_ksud_to_bin() -> Result<()> {
let ksu_bin = PathBuf::from(defs::DAEMON_PATH);