Skip to content

Commit 9b9e145

Browse files
authored
Consolidate dirs deps (#320)
It seems like the project ended up with two different dependencies providing access to the home directory. This PR consolidates these dependencies into a single dependency. I've done so by using the `home` crate since on linux it has 0 dependencies and is well supported due to being a part of the cargo repo. But if you'd prefer I could swap this PR to use `dirs-next`. I would like to avoid `dirs` since it is pulling in strange dependencies dirs-dev/dirs-sys-rs#26
1 parent 0dae017 commit 9b9e145

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

russh-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ version = "0.7.1"
1111
rust-version = "1.65"
1212

1313
[dependencies]
14-
dirs-next = "2.0"
14+
home = "0.5"
1515
futures = { workspace = true }
1616
globset = "0.4.14"
1717
log = { workspace = true }

russh-config/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Config {
8686
}
8787

8888
pub fn parse_home(host: &str) -> Result<Config, Error> {
89-
let mut home = if let Some(home) = dirs_next::home_dir() {
89+
let mut home = if let Some(home) = home::home_dir() {
9090
home
9191
} else {
9292
return Err(Error::NoHome);
@@ -135,7 +135,7 @@ pub fn parse(file: &str, host: &str) -> Result<Config, Error> {
135135
"identityfile" => {
136136
let id = value.trim_start();
137137
if id.starts_with("~/") {
138-
if let Some(mut home) = dirs_next::home_dir() {
138+
if let Some(mut home) = home::home_dir() {
139139
home.push(id.split_at(2).1);
140140
config.identity_file = Some(
141141
home.to_str()

russh-keys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ byteorder = { workspace = true }
2222
data-encoding = "2.3"
2323
digest = { workspace = true }
2424
der = "0.7"
25-
dirs = "5.0"
25+
home = "0.5"
2626
ecdsa = "0.16"
2727
ed25519-dalek = { version = "2.0", features = ["rand_core", "pkcs8"] }
2828
elliptic-curve = "0.13"

russh-keys/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ pub fn check_known_hosts_path<P: AsRef<Path>>(
503503

504504
#[cfg(target_os = "windows")]
505505
fn known_hosts_path() -> Result<PathBuf, Error> {
506-
if let Some(home_dir) = dirs::home_dir() {
506+
if let Some(home_dir) = home::home_dir() {
507507
Ok(home_dir.join("ssh").join("known_hosts"))
508508
} else {
509509
Err(Error::NoHomeDir)
@@ -512,7 +512,7 @@ fn known_hosts_path() -> Result<PathBuf, Error> {
512512

513513
#[cfg(not(target_os = "windows"))]
514514
fn known_hosts_path() -> Result<PathBuf, Error> {
515-
if let Some(home_dir) = dirs::home_dir() {
515+
if let Some(home_dir) = home::home_dir() {
516516
Ok(home_dir.join(".ssh").join("known_hosts"))
517517
} else {
518518
Err(Error::NoHomeDir)

0 commit comments

Comments
 (0)