diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 4af3cd9f9..f47be3da3 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -89,7 +89,7 @@ pub struct Config { #[serde(default)] salt: String, #[serde(default)] - pub key_pair: (Vec, Vec), // sk, pk + key_pair: (Vec, Vec), // sk, pk #[serde(default)] key_confirmed: bool, #[serde(default)] @@ -321,6 +321,10 @@ impl Config { Config::with_extension(Self::path(name)) } + pub fn is_empty(&self) -> bool { + self.id.is_empty() || self.key_pair.0.is_empty() + } + pub fn get_home() -> PathBuf { #[cfg(any(target_os = "android", target_os = "ios"))] return Self::path(APP_HOME_DIR.read().unwrap().as_str()); diff --git a/src/main.rs b/src/main.rs index 06d67ceee..7dcd962bf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -172,7 +172,7 @@ fn import_config(path: &str) { let path = std::path::Path::new(path); log::info!("import config from {:?} and {:?}", path, path2); let config: Config = load_path(path.into()); - if config.id.is_empty() || config.key_pair.0.is_empty() { + if config.is_empty() { log::info!("Empty source config, skipped"); return; }