From 98a1de91a2dae06323558422c239e5a45fc86e7b Mon Sep 17 00:00:00 2001 From: hozan23 Date: Tue, 28 Nov 2023 22:41:33 +0300 Subject: implement TLS for inbound and outbound connections --- core/src/utils/path.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 core/src/utils/path.rs (limited to 'core/src/utils/path.rs') diff --git a/core/src/utils/path.rs b/core/src/utils/path.rs deleted file mode 100644 index 2cd900a..0000000 --- a/core/src/utils/path.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::path::PathBuf; - -use crate::{error::Error, Result}; - -/// Returns the user's home directory as a `PathBuf`. -#[allow(dead_code)] -pub fn home_dir() -> Result { - dirs::home_dir().ok_or(Error::PathNotFound("Home dir not found")) -} - -/// Expands a tilde (~) in a path and returns the expanded `PathBuf`. -#[allow(dead_code)] -pub fn tilde_expand(path: &str) -> Result { - match path { - "~" => home_dir(), - p if p.starts_with("~/") => Ok(home_dir()?.join(&path[2..])), - _ => Ok(PathBuf::from(path)), - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_tilde_expand() { - let path = "~/src"; - let expanded_path = dirs::home_dir().unwrap().join("src"); - assert_eq!(tilde_expand(path).unwrap(), expanded_path); - - let path = "~"; - let expanded_path = dirs::home_dir().unwrap(); - assert_eq!(tilde_expand(path).unwrap(), expanded_path); - - let path = ""; - let expanded_path = PathBuf::from(""); - assert_eq!(tilde_expand(path).unwrap(), expanded_path); - } -} -- cgit v1.2.3