From a00df7ffbb205298e39597eee60b7bb175594035 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Wed, 15 Mar 2023 14:56:48 +0200 Subject: [PATCH] feat(cli): separate net dir (#1764) --- bin/reth/src/dirs.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/reth/src/dirs.rs b/bin/reth/src/dirs.rs index c5ac09bbc..72e83e587 100644 --- a/bin/reth/src/dirs.rs +++ b/bin/reth/src/dirs.rs @@ -44,11 +44,18 @@ pub fn logs_dir() -> Option { /// Returns the path to the reth jwtsecret directory. /// -/// Refer to [dirs_next::cache_dir] for cross-platform behavior. +/// Refer to [dirs_next::data_dir] for cross-platform behavior. pub fn jwt_secret_dir() -> Option { data_dir().map(|root| root.join("jwtsecret")) } +/// Returns the path to the reth net directory. +/// +/// Refer to [dirs_next::data_dir] +pub fn net_dir() -> Option { + data_dir().map(|root| root.join("net")) +} + /// Returns the path to the reth database. /// /// Refer to [dirs_next::data_dir] for cross-platform behavior. @@ -90,14 +97,14 @@ impl XdgPath for ConfigPath { /// Returns the path to the default reth known peers file. /// -/// Refer to [dirs_next::config_dir] for cross-platform behavior. +/// Refer to [dirs_next::data_dir] for cross-platform behavior. #[derive(Default, Debug, Clone)] #[non_exhaustive] pub struct KnownPeersPath; impl XdgPath for KnownPeersPath { fn resolve() -> Option { - database_path().map(|p| p.join("known-peers.json")) + net_dir().map(|p| p.join("known-peers.json")) } }