From 0db28d54dc0ebb20ea722aac0ff474aaadfe39cd Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Wed, 31 Jul 2024 17:52:09 +1000 Subject: [PATCH] Consolidate dirs deps --- russh-config/Cargo.toml | 2 +- russh-config/src/lib.rs | 4 ++-- russh-keys/Cargo.toml | 2 +- russh-keys/src/lib.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/russh-config/Cargo.toml b/russh-config/Cargo.toml index 096dacf..0f776b9 100644 --- a/russh-config/Cargo.toml +++ b/russh-config/Cargo.toml @@ -11,7 +11,7 @@ version = "0.7.1" rust-version = "1.65" [dependencies] -dirs-next = "2.0" +home = "0.5" futures = { workspace = true } globset = "0.4.14" log = { workspace = true } diff --git a/russh-config/src/lib.rs b/russh-config/src/lib.rs index 6b6ab23..bb87abb 100644 --- a/russh-config/src/lib.rs +++ b/russh-config/src/lib.rs @@ -86,7 +86,7 @@ impl Config { } pub fn parse_home(host: &str) -> Result { - let mut home = if let Some(home) = dirs_next::home_dir() { + let mut home = if let Some(home) = home::home_dir() { home } else { return Err(Error::NoHome); @@ -135,7 +135,7 @@ pub fn parse(file: &str, host: &str) -> Result { "identityfile" => { let id = value.trim_start(); if id.starts_with("~/") { - if let Some(mut home) = dirs_next::home_dir() { + if let Some(mut home) = home::home_dir() { home.push(id.split_at(2).1); config.identity_file = Some( home.to_str() diff --git a/russh-keys/Cargo.toml b/russh-keys/Cargo.toml index aa17bd3..00df53a 100644 --- a/russh-keys/Cargo.toml +++ b/russh-keys/Cargo.toml @@ -22,7 +22,7 @@ byteorder = { workspace = true } data-encoding = "2.3" digest = { workspace = true } der = "0.7" -dirs = "5.0" +home = "0.5" ecdsa = "0.16" ed25519-dalek = { version = "2.0", features = ["rand_core", "pkcs8"] } elliptic-curve = "0.13" diff --git a/russh-keys/src/lib.rs b/russh-keys/src/lib.rs index f71f4d5..cc895ed 100644 --- a/russh-keys/src/lib.rs +++ b/russh-keys/src/lib.rs @@ -503,7 +503,7 @@ pub fn check_known_hosts_path>( #[cfg(target_os = "windows")] fn known_hosts_path() -> Result { - if let Some(home_dir) = dirs::home_dir() { + if let Some(home_dir) = home::home_dir() { Ok(home_dir.join("ssh").join("known_hosts")) } else { Err(Error::NoHomeDir) @@ -512,7 +512,7 @@ fn known_hosts_path() -> Result { #[cfg(not(target_os = "windows"))] fn known_hosts_path() -> Result { - if let Some(home_dir) = dirs::home_dir() { + if let Some(home_dir) = home::home_dir() { Ok(home_dir.join(".ssh").join("known_hosts")) } else { Err(Error::NoHomeDir)