From 69f821baef21fac5ef4db237467a302b8ead22ea Mon Sep 17 00:00:00 2001 From: veeso Date: Mon, 21 Oct 2024 10:32:50 +0200 Subject: [PATCH] fix: cfg unix forbidden in rust .82 --- build.rs | 2 +- src/cli/remote.rs | 6 +-- src/config/bookmarks.rs | 6 +-- src/config/bookmarks/smb.rs | 2 +- src/config/serialization.rs | 6 +-- src/explorer/formatter.rs | 22 ++++---- src/explorer/mod.rs | 2 +- src/filetransfer/params.rs | 2 +- src/filetransfer/params/smb.rs | 24 ++++----- src/host/localhost.rs | 50 +++++++++---------- src/system/watcher/mod.rs | 2 +- src/ui/activities/auth/bookmarks.rs | 4 +- src/ui/activities/auth/components/form.rs | 6 +-- src/ui/activities/auth/components/mod.rs | 2 +- src/ui/activities/auth/misc.rs | 2 +- src/ui/activities/auth/mod.rs | 6 +-- src/ui/activities/auth/update.rs | 16 +++--- src/ui/activities/auth/view.rs | 16 +++--- .../filetransfer/components/popups.rs | 6 +-- .../filetransfer/components/popups/goto.rs | 2 +- src/ui/activities/filetransfer/update.rs | 4 +- src/utils/fmt.rs | 2 +- 22 files changed, 95 insertions(+), 95 deletions(-) diff --git a/build.rs b/build.rs index ca33ce6..4d571f5 100644 --- a/build.rs +++ b/build.rs @@ -7,7 +7,7 @@ fn main() -> Result<(), Box> { // Platforms macos: { target_os = "macos" }, linux: { target_os = "linux" }, - unix: { target_family = "unix" }, + posix: { target_family = "unix" }, windows: { target_family = "windows" }, // exclusive features smb: { all(feature = "smb", not( macos )) }, diff --git a/src/cli/remote.rs b/src/cli/remote.rs index 3fc640f..ea1ba01 100644 --- a/src/cli/remote.rs +++ b/src/cli/remote.rs @@ -180,7 +180,7 @@ mod test { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_should_make_remote_args_from_two_remotes_and_local_dir() { let args = Args { positional: vec![ @@ -224,7 +224,7 @@ mod test { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_should_make_remote_args_from_two_bookmarks_and_local_dir() { let args = Args { bookmark: vec!["foo".to_string(), "bar".to_string()], @@ -254,7 +254,7 @@ mod test { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_should_make_remote_args_from_one_bookmark_and_one_remote_with_local_dir() { let args = Args { positional: vec!["scp://host1".to_string(), "/home".to_string()], diff --git a/src/config/bookmarks.rs b/src/config/bookmarks.rs index 8e422b8..55ba16c 100644 --- a/src/config/bookmarks.rs +++ b/src/config/bookmarks.rs @@ -108,7 +108,7 @@ impl From for Bookmark { smb: Some(SmbParams::from(params.clone())), protocol, address: Some(params.address), - #[cfg(unix)] + #[cfg(posix)] port: Some(params.port), #[cfg(windows)] port: None, @@ -159,7 +159,7 @@ impl From for FileTransferParams { let params = KubeProtocolParams::from(params); Self::new(bookmark.protocol, ProtocolParams::Kube(params)) } - #[cfg(unix)] + #[cfg(posix)] FileTransferProtocol::Smb => { let params = TransferSmbParams::new( bookmark.address.unwrap_or_default(), @@ -521,7 +521,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn should_get_ftparams_from_smb_bookmark() { let bookmark: Bookmark = Bookmark { protocol: FileTransferProtocol::Smb, diff --git a/src/config/bookmarks/smb.rs b/src/config/bookmarks/smb.rs index bf92e5e..1ccb137 100644 --- a/src/config/bookmarks/smb.rs +++ b/src/config/bookmarks/smb.rs @@ -9,7 +9,7 @@ pub struct SmbParams { pub workgroup: Option, } -#[cfg(unix)] +#[cfg(posix)] impl From for SmbParams { fn from(params: TransferSmbParams) -> Self { Self { diff --git a/src/config/serialization.rs b/src/config/serialization.rs index fab0370..f19f904 100644 --- a/src/config/serialization.rs +++ b/src/config/serialization.rs @@ -422,14 +422,14 @@ mod tests { let host = hosts.bookmarks.get("smb").unwrap(); assert_eq!(host.address.as_deref().unwrap(), "localhost"); assert_eq!(host.port.unwrap(), 445); - #[cfg(unix)] + #[cfg(posix)] assert_eq!(host.username.as_deref().unwrap(), "test"); - #[cfg(unix)] + #[cfg(posix)] assert_eq!(host.password.as_deref().unwrap(), "test"); let smb = host.smb.as_ref().unwrap(); assert_eq!(smb.share.as_str(), "temp"); - #[cfg(unix)] + #[cfg(posix)] assert_eq!(smb.workgroup.as_deref().unwrap(), "test"); } diff --git a/src/explorer/formatter.rs b/src/explorer/formatter.rs index 91415f8..5d57488 100644 --- a/src/explorer/formatter.rs +++ b/src/explorer/formatter.rs @@ -11,7 +11,7 @@ use bytesize::ByteSize; use lazy_regex::{Lazy, Regex}; use remotefs::File; use unicode_width::UnicodeWidthStr; -#[cfg(unix)] +#[cfg(posix)] use uzers::{get_group_by_gid, get_user_by_uid}; use crate::utils::fmt::{fmt_path_elide, fmt_pex, fmt_time}; @@ -211,7 +211,7 @@ impl Formatter { _fmt_extra: Option<&String>, ) -> String { // Get username - #[cfg(unix)] + #[cfg(posix)] let group: String = match fsentry.metadata().gid { Some(gid) => match get_group_by_gid(gid) { Some(user) => user.name().to_string_lossy().to_string(), @@ -420,7 +420,7 @@ impl Formatter { _fmt_extra: Option<&String>, ) -> String { // Get username - #[cfg(unix)] + #[cfg(posix)] let username: String = match fsentry.metadata().uid { Some(uid) => match get_user_by_uid(uid) { Some(user) => user.name().to_string_lossy().to_string(), @@ -592,7 +592,7 @@ mod tests { mode: Some(UnixPex::from(0o644)), }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -623,7 +623,7 @@ mod tests { mode: Some(UnixPex::from(0o644)), }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -654,7 +654,7 @@ mod tests { mode: None, }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -685,7 +685,7 @@ mod tests { mode: None, }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -723,7 +723,7 @@ mod tests { mode: Some(UnixPex::from(0o755)), }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -754,7 +754,7 @@ mod tests { mode: None, }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( formatter.fmt(&entry), format!( @@ -864,7 +864,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn should_fmt_path() { let t: SystemTime = SystemTime::now(); let entry = File { @@ -896,7 +896,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn should_fmt_utf8_path() { let t: SystemTime = SystemTime::now(); let entry = File { diff --git a/src/explorer/mod.rs b/src/explorer/mod.rs index 298cf1d..54aa9c6 100644 --- a/src/explorer/mod.rs +++ b/src/explorer/mod.rs @@ -519,7 +519,7 @@ mod tests { mode: Some(UnixPex::from(0o644)), }, }; - #[cfg(unix)] + #[cfg(posix)] assert_eq!( explorer.fmt_file(&entry), format!( diff --git a/src/filetransfer/params.rs b/src/filetransfer/params.rs index b98ffdf..d6d3ea8 100644 --- a/src/filetransfer/params.rs +++ b/src/filetransfer/params.rs @@ -362,7 +362,7 @@ mod test { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn set_default_secret_smb() { let mut params = FileTransferParams::new( FileTransferProtocol::Scp, diff --git a/src/filetransfer/params/smb.rs b/src/filetransfer/params/smb.rs index da53bb5..779062c 100644 --- a/src/filetransfer/params/smb.rs +++ b/src/filetransfer/params/smb.rs @@ -2,12 +2,12 @@ #[derive(Debug, Clone)] pub struct SmbParams { pub address: String, - #[cfg(unix)] + #[cfg(posix)] pub port: u16, pub share: String, pub username: Option, pub password: Option, - #[cfg(unix)] + #[cfg(posix)] pub workgroup: Option, } @@ -18,17 +18,17 @@ impl SmbParams { pub fn new>(address: S, share: S) -> Self { Self { address: address.as_ref().to_string(), - #[cfg(unix)] + #[cfg(posix)] port: 445, share: share.as_ref().to_string(), username: None, password: None, - #[cfg(unix)] + #[cfg(posix)] workgroup: None, } } - #[cfg(unix)] + #[cfg(posix)] pub fn port(mut self, port: u16) -> Self { self.port = port; self @@ -44,7 +44,7 @@ impl SmbParams { self } - #[cfg(unix)] + #[cfg(posix)] pub fn workgroup(mut self, workgroup: Option) -> Self { self.workgroup = workgroup.map(|x| x.to_string()); self @@ -57,7 +57,7 @@ impl SmbParams { } /// Set password - #[cfg(unix)] + #[cfg(posix)] pub fn set_default_secret(&mut self, secret: String) { self.password = Some(secret); } @@ -78,20 +78,20 @@ mod test { let params = SmbParams::new("localhost", "temp"); assert_eq!(¶ms.address, "localhost"); - #[cfg(unix)] + #[cfg(posix)] assert_eq!(params.port, 445); assert_eq!(¶ms.share, "temp"); - #[cfg(unix)] + #[cfg(posix)] assert!(params.username.is_none()); - #[cfg(unix)] + #[cfg(posix)] assert!(params.password.is_none()); - #[cfg(unix)] + #[cfg(posix)] assert!(params.workgroup.is_none()); } #[test] - #[cfg(unix)] + #[cfg(posix)] fn should_init_smb_params_with_optionals() { let params = SmbParams::new("localhost", "temp") .port(3456) diff --git a/src/host/localhost.rs b/src/host/localhost.rs index 5534d37..94ccda5 100644 --- a/src/host/localhost.rs +++ b/src/host/localhost.rs @@ -1,6 +1,6 @@ use std::fs::{self, OpenOptions}; use std::io::{Read, Write}; -#[cfg(unix)] +#[cfg(posix)] use std::os::unix::fs::PermissionsExt as _; use std::path::{Path, PathBuf}; @@ -385,7 +385,7 @@ impl HostBridge for Localhost { filetime::set_file_atime(path, atime) .map_err(|e| HostError::new(HostErrorType::FileNotAccessible, Some(e), path))?; } - #[cfg(unix)] + #[cfg(posix)] if let Some(mode) = metadata.mode { self.chmod(path, mode)?; } @@ -417,7 +417,7 @@ impl HostBridge for Localhost { } } - #[cfg(unix)] + #[cfg(posix)] fn symlink(&mut self, src: &Path, dst: &Path) -> HostResult<()> { let src = self.to_path(src); std::os::unix::fs::symlink(dst, src.as_path()).map_err(|e| { @@ -438,7 +438,7 @@ impl HostBridge for Localhost { Err(HostError::from(HostErrorType::NotImplemented)) } - #[cfg(unix)] + #[cfg(posix)] fn chmod(&mut self, path: &std::path::Path, pex: UnixPex) -> HostResult<()> { let path: PathBuf = self.to_path(path); // Get metadta @@ -553,19 +553,19 @@ impl HostBridge for Localhost { #[cfg(test)] mod tests { - #[cfg(unix)] + #[cfg(posix)] use std::fs::File as StdFile; - #[cfg(unix)] + #[cfg(posix)] use std::io::Write; use std::ops::AddAssign; - #[cfg(unix)] + #[cfg(posix)] use std::os::unix::fs::{symlink, PermissionsExt}; use std::time::{Duration, SystemTime}; use pretty_assertions::assert_eq; use super::*; - #[cfg(unix)] + #[cfg(posix)] use crate::utils::test_helpers::make_fsentry; use crate::utils::test_helpers::{create_sample_file, make_file_at}; @@ -578,7 +578,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_new() { let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); assert_eq!(host.wrkdir, PathBuf::from("/dev")); @@ -614,14 +614,14 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_pwd() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); assert_eq!(host.pwd().unwrap(), PathBuf::from("/dev")); } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_change_dir() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); let new_dir: PathBuf = PathBuf::from("/dev"); @@ -637,7 +637,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] #[should_panic] fn test_host_localhost_change_dir_failed() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); @@ -646,7 +646,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_open_read() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); // Create temp file @@ -655,7 +655,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] #[should_panic] fn test_host_localhost_open_read_err_no_such_file() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); @@ -676,7 +676,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_open_write() { let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); // Create temp file @@ -695,7 +695,7 @@ mod tests { assert!(host.create_file(file.path(), &Metadata::default()).is_err()); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_localhost_symlinks() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -733,7 +733,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_mkdir() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); let mut host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap(); @@ -758,7 +758,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_remove() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); // Create sample file @@ -787,7 +787,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_host_localhost_rename() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); // Create sample file @@ -840,7 +840,7 @@ mod tests { assert_eq!(new_metadata.metadata().modified, Some(new_mtime)); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_chmod() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -859,7 +859,7 @@ mod tests { .is_err()); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_copy_file_absolute() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -889,7 +889,7 @@ mod tests { .is_err()); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_copy_file_relative() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -911,7 +911,7 @@ mod tests { assert_eq!(host.files.len(), 2); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_copy_directory_absolute() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -942,7 +942,7 @@ mod tests { assert!(host.stat(test_file_path.as_path()).is_ok()); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn test_host_copy_directory_relative() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); @@ -980,7 +980,7 @@ mod tests { assert!(host.exec("echo 5").ok().unwrap().as_str().contains("5")); } - #[cfg(unix)] + #[cfg(posix)] #[test] fn should_create_symlink() { let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap(); diff --git a/src/system/watcher/mod.rs b/src/system/watcher/mod.rs index 0472505..9a74718 100644 --- a/src/system/watcher/mod.rs +++ b/src/system/watcher/mod.rs @@ -385,7 +385,7 @@ mod test { /* #[test] - #[cfg(unix)] + #[cfg(posix)] fn should_poll_file_moved() { let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap(); let tempdir = TempDir::new().unwrap(); diff --git a/src/ui/activities/auth/bookmarks.rs b/src/ui/activities/auth/bookmarks.rs index 416a909..db504bc 100644 --- a/src/ui/activities/auth/bookmarks.rs +++ b/src/ui/activities/auth/bookmarks.rs @@ -280,12 +280,12 @@ impl AuthActivity { fn load_bookmark_smb_into_gui(&mut self, form_tab: FormTab, params: SmbParams) { self.mount_address(form_tab, params.address.as_str()); - #[cfg(unix)] + #[cfg(posix)] self.mount_port(form_tab, params.port); self.mount_username(form_tab, params.username.as_deref().unwrap_or("")); self.mount_password(form_tab, params.password.as_deref().unwrap_or("")); self.mount_smb_share(form_tab, ¶ms.share); - #[cfg(unix)] + #[cfg(posix)] self.mount_smb_workgroup(form_tab, params.workgroup.as_deref().unwrap_or("")); } diff --git a/src/ui/activities/auth/components/form.rs b/src/ui/activities/auth/components/form.rs index aafdbc0..b60f041 100644 --- a/src/ui/activities/auth/components/form.rs +++ b/src/ui/activities/auth/components/form.rs @@ -952,14 +952,14 @@ impl Component for InputSmbShare { } } -#[cfg(unix)] +#[cfg(posix)] #[derive(MockComponent)] pub struct InputSmbWorkgroup { component: Input, form_tab: FormTab, } -#[cfg(unix)] +#[cfg(posix)] impl InputSmbWorkgroup { pub fn new(host: &str, form_tab: FormTab, color: Color) -> Self { Self { @@ -978,7 +978,7 @@ impl InputSmbWorkgroup { } } -#[cfg(unix)] +#[cfg(posix)] impl Component for InputSmbWorkgroup { fn on(&mut self, ev: Event) -> Option { let on_key_down = match self.form_tab { diff --git a/src/ui/activities/auth/components/mod.rs b/src/ui/activities/auth/components/mod.rs index 353ca93..d5d8f85 100644 --- a/src/ui/activities/auth/components/mod.rs +++ b/src/ui/activities/auth/components/mod.rs @@ -13,7 +13,7 @@ pub use bookmarks::{ BookmarkName, BookmarkSavePassword, BookmarksList, DeleteBookmarkPopup, DeleteRecentPopup, RecentsList, }; -#[cfg(unix)] +#[cfg(posix)] pub use form::InputSmbWorkgroup; pub use form::{ HostBridgeProtocolRadio, InputAddress, InputKubeClientCert, InputKubeClientKey, diff --git a/src/ui/activities/auth/misc.rs b/src/ui/activities/auth/misc.rs index 423ad05..5e7926b 100644 --- a/src/ui/activities/auth/misc.rs +++ b/src/ui/activities/auth/misc.rs @@ -151,7 +151,7 @@ impl AuthActivity { if params.address.is_empty() { return Err("Invalid address"); } - #[cfg(unix)] + #[cfg(posix)] if params.port == 0 { return Err("Invalid port"); } diff --git a/src/ui/activities/auth/mod.rs b/src/ui/activities/auth/mod.rs index 8025649..371a260 100644 --- a/src/ui/activities/auth/mod.rs +++ b/src/ui/activities/auth/mod.rs @@ -93,7 +93,7 @@ pub enum AuthFormId { S3SecurityToken, S3SessionToken, SmbShare, - #[cfg(unix)] + #[cfg(posix)] SmbWorkgroup, Username, WebDAVUri, @@ -193,9 +193,9 @@ pub enum UiAuthFormMsg { S3SessionTokenBlurUp, SmbShareBlurDown, SmbShareBlurUp, - #[cfg(unix)] + #[cfg(posix)] SmbWorkgroupDown, - #[cfg(unix)] + #[cfg(posix)] SmbWorkgroupUp, UsernameBlurDown, UsernameBlurUp, diff --git a/src/ui/activities/auth/update.rs b/src/ui/activities/auth/update.rs index 44b486a..627a967 100644 --- a/src/ui/activities/auth/update.rs +++ b/src/ui/activities/auth/update.rs @@ -269,7 +269,7 @@ impl AuthActivity { .active(match self.host_bridge_input_mask() { InputMask::Localhost => unreachable!(), InputMask::Generic => &Id::HostBridge(AuthFormId::RemoteDirectory), - #[cfg(unix)] + #[cfg(posix)] InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup), #[cfg(windows)] InputMask::Smb => &Id::HostBridge(AuthFormId::RemoteDirectory), @@ -285,7 +285,7 @@ impl AuthActivity { .active(match self.remote_input_mask() { InputMask::Localhost => unreachable!(), InputMask::Generic => &Id::Remote(AuthFormId::RemoteDirectory), - #[cfg(unix)] + #[cfg(posix)] InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup), #[cfg(windows)] InputMask::Smb => &Id::Remote(AuthFormId::RemoteDirectory), @@ -400,7 +400,7 @@ impl AuthActivity { .active(match self.host_bridge_input_mask() { InputMask::Localhost => unreachable!(), InputMask::Generic => &Id::HostBridge(AuthFormId::Password), - #[cfg(unix)] + #[cfg(posix)] InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup), #[cfg(windows)] InputMask::Smb => &Id::HostBridge(AuthFormId::Password), @@ -416,7 +416,7 @@ impl AuthActivity { .active(match self.remote_input_mask() { InputMask::Localhost => unreachable!(), InputMask::Generic => &Id::Remote(AuthFormId::Password), - #[cfg(unix)] + #[cfg(posix)] InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup), #[cfg(windows)] InputMask::Smb => &Id::Remote(AuthFormId::Password), @@ -760,28 +760,28 @@ impl AuthActivity { }; assert!(self.app.active(id).is_ok()); } - #[cfg(unix)] + #[cfg(posix)] UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupDown) => { assert!(self .app .active(&Id::HostBridge(AuthFormId::RemoteDirectory)) .is_ok()); } - #[cfg(unix)] + #[cfg(posix)] UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupDown) => { assert!(self .app .active(&Id::Remote(AuthFormId::RemoteDirectory)) .is_ok()); } - #[cfg(unix)] + #[cfg(posix)] UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupUp) => { assert!(self .app .active(&Id::HostBridge(AuthFormId::Password)) .is_ok()); } - #[cfg(unix)] + #[cfg(posix)] UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupUp) => { assert!(self.app.active(&Id::Remote(AuthFormId::Password)).is_ok()); } diff --git a/src/ui/activities/auth/view.rs b/src/ui/activities/auth/view.rs index 32d3edb..51c2697 100644 --- a/src/ui/activities/auth/view.rs +++ b/src/ui/activities/auth/view.rs @@ -69,7 +69,7 @@ impl AuthActivity { self.mount_kube_namespace(FormTab::HostBridge, ""); self.mount_kube_username(FormTab::HostBridge, ""); self.mount_smb_share(FormTab::HostBridge, ""); - #[cfg(unix)] + #[cfg(posix)] self.mount_smb_workgroup(FormTab::HostBridge, ""); self.mount_webdav_uri(FormTab::HostBridge, ""); @@ -102,7 +102,7 @@ impl AuthActivity { self.mount_kube_namespace(FormTab::Remote, ""); self.mount_kube_username(FormTab::Remote, ""); self.mount_smb_share(FormTab::Remote, ""); - #[cfg(unix)] + #[cfg(posix)] self.mount_smb_workgroup(FormTab::Remote, ""); self.mount_webdav_uri(FormTab::Remote, ""); @@ -1042,7 +1042,7 @@ impl AuthActivity { .is_ok()); } - #[cfg(unix)] + #[cfg(posix)] pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) { let color = self.theme().auth_address; let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup); @@ -1130,7 +1130,7 @@ impl AuthActivity { } /// Collect s3 input values from view - #[cfg(unix)] + #[cfg(posix)] pub(super) fn get_smb_params_input(&self, form_tab: FormTab) -> SmbParams { let share: String = self.get_input_smb_share(form_tab); let workgroup: Option = self.get_input_smb_workgroup(form_tab); @@ -1394,7 +1394,7 @@ impl AuthActivity { } } - #[cfg(unix)] + #[cfg(posix)] pub(super) fn get_input_smb_workgroup(&self, form_tab: FormTab) -> Option { match self .app @@ -1494,7 +1494,7 @@ impl AuthActivity { .unwrap_or_default() ) } - #[cfg(unix)] + #[cfg(posix)] ProtocolParams::Smb(params) => { let username: String = match params.username { None => String::default(), @@ -1749,7 +1749,7 @@ impl AuthActivity { } } - #[cfg(unix)] + #[cfg(posix)] fn get_host_bridge_smb_view(&self) -> [Id; 4] { match self.app.focus() { Some( @@ -1796,7 +1796,7 @@ impl AuthActivity { } } - #[cfg(unix)] + #[cfg(posix)] fn get_remote_smb_view(&self) -> [Id; 4] { match self.app.focus() { Some( diff --git a/src/ui/activities/filetransfer/components/popups.rs b/src/ui/activities/filetransfer/components/popups.rs index 6e1776f..4ea671f 100644 --- a/src/ui/activities/filetransfer/components/popups.rs +++ b/src/ui/activities/filetransfer/components/popups.rs @@ -16,7 +16,7 @@ use tuirealm::props::{ Alignment, BorderSides, BorderType, Borders, Color, InputType, Style, TableBuilder, TextSpan, }; use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue}; -#[cfg(unix)] +#[cfg(posix)] use uzers::{get_group_by_gid, get_user_by_uid}; pub use self::chmod::ChmodPopup; @@ -533,7 +533,7 @@ impl FileInfoPopup { .add_col(TextSpan::from("Last access time: ")) .add_col(TextSpan::new(atime.as_str()).fg(Color::LightRed)); // User - #[cfg(unix)] + #[cfg(posix)] let username: String = match file.metadata().uid { Some(uid) => match get_user_by_uid(uid) { Some(user) => user.name().to_string_lossy().to_string(), @@ -544,7 +544,7 @@ impl FileInfoPopup { #[cfg(windows)] let username: String = format!("{}", file.metadata().uid.unwrap_or(0)); // Group - #[cfg(unix)] + #[cfg(posix)] let group: String = match file.metadata().gid { Some(gid) => match get_group_by_gid(gid) { Some(group) => group.name().to_string_lossy().to_string(), diff --git a/src/ui/activities/filetransfer/components/popups/goto.rs b/src/ui/activities/filetransfer/components/popups/goto.rs index 9c91055..d7447d1 100644 --- a/src/ui/activities/filetransfer/components/popups/goto.rs +++ b/src/ui/activities/filetransfer/components/popups/goto.rs @@ -365,7 +365,7 @@ mod test { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_should_suggest_absolute_path() { let mut states = OwnStates { files: vec![ diff --git a/src/ui/activities/filetransfer/update.rs b/src/ui/activities/filetransfer/update.rs index e60d732..6d872e9 100644 --- a/src/ui/activities/filetransfer/update.rs +++ b/src/ui/activities/filetransfer/update.rs @@ -494,9 +494,9 @@ impl FileTransferActivity { } UiMsg::ShowChmodPopup => { let selected_file = match self.browser.tab() { - #[cfg(unix)] + #[cfg(posix)] FileExplorerTab::HostBridge => self.get_local_selected_entries(), - #[cfg(unix)] + #[cfg(posix)] FileExplorerTab::FindHostBridge => self.get_found_selected_entries(), FileExplorerTab::Remote => self.get_remote_selected_entries(), FileExplorerTab::FindRemote => self.get_found_selected_entries(), diff --git a/src/utils/fmt.rs b/src/utils/fmt.rs index fb3528c..c203d34 100644 --- a/src/utils/fmt.rs +++ b/src/utils/fmt.rs @@ -308,7 +308,7 @@ mod tests { } #[test] - #[cfg(unix)] + #[cfg(posix)] fn test_utils_fmt_path_elide() { let p: &Path = Path::new("/develop/pippo"); // Under max size