Add some info statements
This commit is contained in:
parent
d8eca30392
commit
78fcdec05a
1 changed files with 15 additions and 13 deletions
|
@ -136,6 +136,7 @@ impl DeletionStrategy {
|
|||
|
||||
// first, are we on the home mount?
|
||||
if target_mount == *HOME_MOUNT {
|
||||
info!("Picking strategy MoveTo because target {:?} was on the home mount.", target);
|
||||
return Ok(DeletionStrategy::MoveTo(TrashDir::get_home_trash()));
|
||||
}
|
||||
|
||||
|
@ -234,15 +235,6 @@ impl DeletionStrategy {
|
|||
None => return Err(Error::Put(PutError::InvalidFilename)),
|
||||
};
|
||||
let file_name = concat_os_str!(elapsed_str, ".", target_file);
|
||||
// {
|
||||
// let buf = vec![0; elapsed_str.len() + 1 + target_file.len()];
|
||||
// unimplemented!()
|
||||
// // format!(
|
||||
// // "{}.{}",
|
||||
// // elapsed,
|
||||
// // target.file_name().unwrap().to_str().unwrap()
|
||||
// // )
|
||||
// };
|
||||
|
||||
let trash_file_path = trash_dir.files_dir()?.join(&file_name);
|
||||
let trash_info_path = trash_dir
|
||||
|
@ -286,19 +278,29 @@ fn should_use_topdir_trash(mount: impl AsRef<Path>) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
let dir = match File::open(trash_dir) {
|
||||
let dir = match File::open(&trash_dir) {
|
||||
Ok(file) => file,
|
||||
Err(_) => return false,
|
||||
Err(err) => {
|
||||
info!("Error opening topdir {:?}: {:?}", trash_dir, err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let meta = match dir.metadata() {
|
||||
Ok(meta) => meta,
|
||||
Err(_) => return false,
|
||||
Err(err) => {
|
||||
info!(
|
||||
"Error getting topdir metadata for {:?}: {:?}",
|
||||
trash_dir, err
|
||||
);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
if meta.file_type().is_symlink() {
|
||||
info!("Trashdir {:?} is a symlink.", trash_dir);
|
||||
return false;
|
||||
}
|
||||
let perms = meta.permissions();
|
||||
|
||||
let perms = meta.permissions();
|
||||
perms.mode() & 0o1000 > 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue