use util functions

master
rascul 5 years ago
parent 8d8f842fb6
commit a172f4c645

@ -1,4 +1,4 @@
use std::fs::{copy as fscopy, metadata, set_permissions, File};
use std::fs::{copy as fscopy, File, Permissions};
use std::os::unix::fs::PermissionsExt;
use std::path::PathBuf;
use std::process::Command;
@ -7,6 +7,7 @@ use regex::Regex;
use crate::config::Config;
use crate::error::*;
use crate::util::set_perms;
pub struct Files {
pub bins: Vec<PathBuf>,
@ -191,28 +192,7 @@ impl Files {
println!("Setting linker {} to mode 0o755", &lib.display());
}
match metadata(&lib) {
Ok(meta) => {
let mut perms = meta.permissions();
perms.set_mode(0o755);
if let Err(e) = set_permissions(&lib, perms) {
return Err(MkrootError::from(format!(
"Error setting permissions {}: {}",
&lib.display(),
e
)));
} else {
return Ok(());
}
}
Err(e) => {
return Err(MkrootError::from(format!(
"Error reading metadata {}: {}",
&lib.display(),
e
)))
}
}
set_perms(&lib, Permissions::from_mode(0o755))?;
}
}
}
@ -244,9 +224,7 @@ impl Files {
e
)));
} else {
let mut perms = metadata(&t)?.permissions();
perms.set_mode(mode);
set_permissions(&t, perms)?;
set_perms(&t, Permissions::from_mode(mode))?;
}
} else if verbose {
println!("Skipping {}", &f.display());

Loading…
Cancel
Save