Introduce path! macro for FsPath

This commit is contained in:
topjohnwu
2025-02-17 01:46:19 -08:00
parent 18cb659ff3
commit fc2ef21660
11 changed files with 92 additions and 116 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
use crate::ffi::{backup_init, BootConfig, MagiskInit};
use base::{cstr, debug, BytesExt, FsPath, MappedFile};
use base::{debug, path, BytesExt, MappedFile};
use std::ffi::CStr;
impl BootConfig {
@@ -27,11 +27,11 @@ impl BootConfig {
impl MagiskInit {
pub(crate) fn check_two_stage(&self) -> bool {
FsPath::from(cstr!("/first_stage_ramdisk")).exists() ||
FsPath::from(cstr!("/second_stage_resources")).exists() ||
FsPath::from(cstr!("/system/bin/init")).exists() ||
path!("/first_stage_ramdisk").exists() ||
path!("/second_stage_resources").exists() ||
path!("/system/bin/init").exists() ||
// Use the apex folder to determine whether 2SI (Android 10+)
FsPath::from(cstr!("/apex")).exists() ||
path!("/apex").exists() ||
// If we still have no indication, parse the original init and see what's up
MappedFile::open(backup_init())
.map(|data| data.contains(b"selinux_setup"))