diff --git a/radicle/src/profile.rs b/radicle/src/profile.rs index b151557c..b54d9a68 100644 --- a/radicle/src/profile.rs +++ b/radicle/src/profile.rs @@ -11,7 +11,7 @@ //! radicle.sock # Node control socket //! use std::io; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use thiserror::Error; @@ -122,6 +122,11 @@ impl Profile { .map(PathBuf::from) .unwrap_or_else(|| self.home.join("node").join(node::DEFAULT_SOCKET_NAME)) } + + /// Get `Paths` of profile + pub fn paths(&self) -> Paths { + Paths { home: &self.home } + } } /// Get the path to the radicle home folder. @@ -137,3 +142,22 @@ pub fn home() -> Result { )) } } + +#[derive(Debug, Clone)] +pub struct Paths<'a> { + home: &'a Path, +} + +impl Paths<'_> { + pub fn storage(&self) -> PathBuf { + self.home.join("storage") + } + + pub fn keys(&self) -> PathBuf { + self.home.join("keys") + } + + pub fn node(&self) -> PathBuf { + self.home.join("node") + } +}