Add some info statements

This commit is contained in:
Michael Zhang 2021-12-30 22:49:33 -06:00
parent d8eca30392
commit 78fcdec05a
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B

View file

@ -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
}