fix set_permissions location

This commit is contained in:
postscriptum 2025-07-04 18:48:28 +03:00
parent 8b8655daf5
commit c56767a1ab

View file

@ -25,6 +25,15 @@ impl Attachment {
match self {
Attachment::Copy => {
fs::copy(source, target)?;
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
fs::set_permissions(target, Permissions::from_mode(0o644))?; // @TODO optional
}
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos",)))]
{
todo!("Platform yet not supported")
}
println!(
"\t\t\tcopied attachment file `{}`",
target.to_string_lossy()
@ -49,7 +58,7 @@ impl Attachment {
}
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos",)))]
{
todo!()
todo!("Platform yet not supported")
}
println!(
"\t\t\tcreated soft link `{}` to attachment {}",
@ -59,11 +68,6 @@ impl Attachment {
}
_ => panic!(), // warn as unexpected
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
fs::set_permissions(target, Permissions::from_mode(0o644))?; // @TODO optional
}
Ok(())
}
}