Skip to content

Commit

Permalink
v2.1: use create_and_canonicalize_directory for snapshots dir (backpo…
Browse files Browse the repository at this point in the history
…rt of #3923) (#3969)

use create_and_canonicalize_directory for snapshots dir (#3923)

* fix snapshot path

* feedback

(cherry picked from commit 31606f5)

Co-authored-by: Yihau Chen <[email protected]>
  • Loading branch information
mergify[bot] and yihau authored Dec 6, 2024
1 parent ad747c2 commit c526431
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 @@ -1619,13 +1622,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 c526431

Please sign in to comment.