Skip to content

Commit

Permalink
start
Browse files Browse the repository at this point in the history
  • Loading branch information
FroVolod committed Feb 13, 2025
1 parent 0c1d2f8 commit dd46c2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2636,7 +2636,7 @@ fn get_used_account_list_path(credentials_home_dir: &std::path::Path) -> std::pa
credentials_home_dir.join("accounts.json")
}

pub fn create_used_account_list_from_keychain(
pub fn create_used_account_list_from_legacy_keychain(
credentials_home_dir: &std::path::Path,
) -> color_eyre::eyre::Result<()> {
let mut used_account_list: std::collections::BTreeSet<near_primitives::types::AccountId> =
Expand All @@ -2661,8 +2661,13 @@ pub fn create_used_account_list_from_keychain(
}
}

let used_account_list_path = get_used_account_list_path(credentials_home_dir);
std::fs::create_dir_all(credentials_home_dir)?;
if !used_account_list_path.exists() {
std::fs::File::create(&used_account_list_path)
.wrap_err_with(|| format!("Failed to create file: {:?}", &used_account_list_path))?;
}
if !used_account_list.is_empty() {
let used_account_list_path = get_used_account_list_path(credentials_home_dir);
let used_account_list_buf = serde_json::to_string(
&used_account_list
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn main() -> crate::common::CliResult {
let config = crate::config::Config::get_config_toml()?;

if !crate::common::is_used_account_list_exist(&config.credentials_home_dir) {
crate::common::create_used_account_list_from_keychain(&config.credentials_home_dir)?;
crate::common::create_used_account_list_from_legacy_keychain(&config.credentials_home_dir)?;
}

#[cfg(not(debug_assertions))]
Expand Down

0 comments on commit dd46c2b

Please sign in to comment.