Use tempfile (#1980)
This commit is contained in:
@@ -211,7 +211,10 @@ pub fn restore(
|
||||
magiskboot_path: Option<PathBuf>,
|
||||
flash: bool,
|
||||
) -> Result<()> {
|
||||
let tmpdir = tempdir::TempDir::new("KernelSU").context("create temp dir failed")?;
|
||||
let tmpdir = tempfile::Builder::new()
|
||||
.prefix("KernelSU")
|
||||
.tempdir()
|
||||
.context("create temp dir failed")?;
|
||||
let workdir = tmpdir.path();
|
||||
let magiskboot = find_magiskboot(magiskboot_path, workdir)?;
|
||||
|
||||
@@ -366,7 +369,10 @@ fn do_patch(
|
||||
);
|
||||
}
|
||||
|
||||
let tmpdir = tempdir::TempDir::new("KernelSU").context("create temp dir failed")?;
|
||||
let tmpdir = tempfile::Builder::new()
|
||||
.prefix("KernelSU")
|
||||
.tempdir()
|
||||
.context("create temp dir failed")?;
|
||||
let workdir = tmpdir.path();
|
||||
|
||||
// extract magiskboot
|
||||
|
||||
@@ -206,7 +206,7 @@ fn find_temp_path() -> String {
|
||||
}
|
||||
|
||||
// Try to create a random directory in /dev/
|
||||
let r = tempdir::TempDir::new_in("/dev/", "");
|
||||
let r = tempfile::tempdir_in("/dev/");
|
||||
match r {
|
||||
Ok(tmp_dir) => {
|
||||
if let Some(path) = tmp_dir.into_path().to_str() {
|
||||
|
||||
Reference in New Issue
Block a user