From 31606f52a49c142813404cd623f9bde7d1800df4 Mon Sep 17 00:00:00 2001 From: Yihau Chen Date: Fri, 6 Dec 2024 11:53:53 +0800 Subject: [PATCH] use create_and_canonicalize_directory for snapshots dir (#3923) * fix snapshot path * feedback --- validator/src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/validator/src/main.rs b/validator/src/main.rs index 26552c7bec9f1f..a7de615b3be9ac 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -24,7 +24,10 @@ use { AccountsIndexConfig, IndexLimitMb, ScanFilter, }, partitioned_rewards::TestPartitionedEpochRewards, - utils::{create_all_accounts_run_and_snapshot_dirs, create_and_canonicalize_directories}, + utils::{ + create_all_accounts_run_and_snapshot_dirs, create_and_canonicalize_directories, + create_and_canonicalize_directory, + }, }, solana_clap_utils::input_parsers::{keypair_of, keypairs_of, pubkey_of, value_of, values_of}, solana_core::{ @@ -1673,13 +1676,14 @@ pub fn main() { } else { &ledger_path }; - let snapshots_dir = fs::canonicalize(snapshots_dir).unwrap_or_else(|err| { + let snapshots_dir = create_and_canonicalize_directory(snapshots_dir).unwrap_or_else(|err| { eprintln!( - "Failed to canonicalize snapshots path '{}': {err}", + "Failed to create snapshots directory '{}': {err}", snapshots_dir.display(), ); exit(1); }); + if account_paths .iter() .any(|account_path| account_path == &snapshots_dir)