From c56767a1ab0bfba7bd5ccb22d6d4c64dbfea31db Mon Sep 17 00:00:00 2001 From: postscriptum Date: Fri, 4 Jul 2025 18:48:28 +0300 Subject: [PATCH] fix `set_permissions` location --- src/nex/attachment.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/nex/attachment.rs b/src/nex/attachment.rs index 014116c..18006d9 100644 --- a/src/nex/attachment.rs +++ b/src/nex/attachment.rs @@ -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(()) } }