From b6b8f6984e2b8bbef7ec02321b6fe84e21056242 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 4 Jul 2018 13:58:38 -0700 Subject: [PATCH 1/2] Add seperate default DB path for light client (#8927) --- parity/configuration.rs | 6 +++++- util/dir/src/lib.rs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/parity/configuration.rs b/parity/configuration.rs index e3fdcce9407..ef088e14b0b 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -970,8 +970,12 @@ impl Configuration { let data_path = replace_home("", &base_path); let is_using_base_path = self.args.arg_base_path.is_some(); // If base_path is set and db_path is not we default to base path subdir instead of LOCAL. - let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() { + let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() && self.args.flag_light { + "$BASE/chains_light" + } else if is_using_base_path && self.args.arg_db_path.is_none() { "$BASE/chains" + } else if self.args.flag_light { + self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH_LIGHT, |s| &s) } else { self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH, |s| &s) }; diff --git a/util/dir/src/lib.rs b/util/dir/src/lib.rs index 712b53f0de3..b802b348d72 100644 --- a/util/dir/src/lib.rs +++ b/util/dir/src/lib.rs @@ -34,10 +34,14 @@ use platform::*; pub use dirs::home_dir; -/// Platform-specific chains path - Windows only +/// Platform-specific chains path for standard client - Windows only #[cfg(target_os = "windows")] pub const CHAINS_PATH: &str = "$LOCAL/chains"; -/// Platform-specific chains path +/// Platform-specific chains path for light client - Windows only +#[cfg(target_os = "windows")] pub const CHAINS_PATH_LIGHT: &str = "$LOCAL/chains_light"; +/// Platform-specific chains path for standard client #[cfg(not(target_os = "windows"))] pub const CHAINS_PATH: &str = "$BASE/chains"; +/// Platform-specific chains path for light client +#[cfg(not(target_os = "windows"))] pub const CHAINS_PATH_LIGHT: &str = "$BASE/chains_light"; /// Platform-specific cache path - Windows only #[cfg(target_os = "windows")] pub const CACHE_PATH: &str = "$LOCAL/cache"; From 233a76f2edd5343768d4135f34146dd3d2f1e7b5 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 10 Jul 2018 20:50:50 -0700 Subject: [PATCH 2/2] Improve readability --- parity/configuration.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parity/configuration.rs b/parity/configuration.rs index ef088e14b0b..e1b11e94aa0 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -970,10 +970,12 @@ impl Configuration { let data_path = replace_home("", &base_path); let is_using_base_path = self.args.arg_base_path.is_some(); // If base_path is set and db_path is not we default to base path subdir instead of LOCAL. - let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() && self.args.flag_light { - "$BASE/chains_light" - } else if is_using_base_path && self.args.arg_db_path.is_none() { - "$BASE/chains" + let base_db_path = if is_using_base_path && self.args.arg_db_path.is_none() { + if self.args.flag_light { + "$BASE/chains_light" + } else { + "$BASE/chains" + } } else if self.args.flag_light { self.args.arg_db_path.as_ref().map_or(dir::CHAINS_PATH_LIGHT, |s| &s) } else {