refactor: replace &PathBuf with &Path to enhance generality (#10332)

This commit is contained in:
Integral
2024-12-23 20:28:04 +08:00
committed by GitHub
parent 7289dbc80f
commit 49dabd3533
13 changed files with 44 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
use std::{
fs::{self},
io::{Cursor, Read},
path::PathBuf,
path::Path,
};
#[cfg(windows)]
@@ -42,7 +42,7 @@ impl BinaryData {
buf
}
pub fn write_to_file(&self, prefix: &PathBuf) {
pub fn write_to_file(&self, prefix: &Path) {
let p = prefix.join(&self.path);
if let Some(parent) = p.parent() {
if !parent.exists() {
@@ -122,7 +122,7 @@ impl BinaryReader {
}
#[cfg(linux)]
pub fn configure_permission(&self, prefix: &PathBuf) {
pub fn configure_permission(&self, prefix: &Path) {
use std::os::unix::prelude::PermissionsExt;
let exe_path = prefix.join(&self.exe);