mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-03-31 21:25:28 +00:00
fix set_permissions location
This commit is contained in:
parent
8b8655daf5
commit
c56767a1ab
1 changed files with 10 additions and 6 deletions
|
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue