You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Make FsPathBuf a trait and rename to FsPathBuilder
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use crate::ffi::MagiskInit;
|
||||
use base::libc::{TMPFS_MAGIC, statfs};
|
||||
use base::{
|
||||
Directory, FsPath, FsPathBuf, FsPathMnt, LibcReturn, LoggedResult, ResultExt, Utf8CStr, cstr,
|
||||
debug, libc,
|
||||
Directory, FsPath, FsPathBuilder, FsPathMnt, LibcReturn, LoggedResult, ResultExt, Utf8CStr,
|
||||
cstr, cstr_buf, debug, libc,
|
||||
libc::{chdir, chroot, execve, exit, mount},
|
||||
parse_mount_info, raw_cstr,
|
||||
};
|
||||
@@ -38,9 +38,9 @@ pub(crate) fn switch_root(path: &Utf8CStr) {
|
||||
|
||||
let mut target = info.target.clone();
|
||||
let target = Utf8CStr::from_string(&mut target);
|
||||
let new_path = FsPathBuf::default()
|
||||
.join(path)
|
||||
.join(info.target.trim_start_matches('/'));
|
||||
let new_path = cstr_buf::default()
|
||||
.join_path(path)
|
||||
.join_path(info.target.trim_start_matches('/'));
|
||||
new_path.mkdirs(0o755).ok();
|
||||
target.move_mount_to(&new_path)?;
|
||||
mounts.insert(info.target);
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::consts::{ROOTMNT, ROOTOVL};
|
||||
use crate::ffi::MagiskInit;
|
||||
use base::libc::{O_CREAT, O_RDONLY, O_WRONLY};
|
||||
use base::{
|
||||
BufReadExt, Directory, FsPath, FsPathBuf, FsPathMnt, LoggedResult, ResultExt, Utf8CStr,
|
||||
BufReadExt, Directory, FsPath, FsPathBuilder, FsPathMnt, LoggedResult, ResultExt, Utf8CStr,
|
||||
Utf8CString, clone_attr, cstr, cstr_buf, debug,
|
||||
};
|
||||
use std::io::BufReader;
|
||||
@@ -72,12 +72,8 @@ impl MagiskInit {
|
||||
None => return Ok(()),
|
||||
Some(e) => {
|
||||
let name = e.name();
|
||||
let src = FsPathBuf::from(cstr_buf::dynamic(256))
|
||||
.join(src_dir)
|
||||
.join(name);
|
||||
let dest = FsPathBuf::from(cstr_buf::dynamic(256))
|
||||
.join(dest_dir)
|
||||
.join(name);
|
||||
let src = cstr_buf::dynamic(256).join_path(src_dir).join_path(name);
|
||||
let dest = cstr_buf::dynamic(256).join_path(dest_dir).join_path(name);
|
||||
if dest.exists() {
|
||||
if e.is_dir() {
|
||||
// Recursive
|
||||
|
||||
Reference in New Issue
Block a user