Skip to content

Commit

Permalink
use create_and_canonicalize_directory for snapshots dir (#3923)
Browse files Browse the repository at this point in the history
* fix snapshot path

* feedback
  • Loading branch information
yihau authored Dec 6, 2024
1 parent 18564ab commit 31606f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 31606f5

Please sign in to comment.