From 027f65a17727014ee2c6dee1e299cbaec57ea2f9 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Mon, 6 Jan 2025 18:56:22 +0000 Subject: [PATCH] fix: create snapshots directory if it doesn't exist --- staking/cli/src/instructions.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/staking/cli/src/instructions.rs b/staking/cli/src/instructions.rs index e2a4c822..34a4c51e 100644 --- a/staking/cli/src/instructions.rs +++ b/staking/cli/src/instructions.rs @@ -1098,6 +1098,10 @@ pub fn save_stake_accounts_snapshot(rpc_client: &RpcClient) { ) .collect::>(); + if !std::path::Path::new("snapshots").exists() { + std::fs::create_dir_all("snapshots").unwrap(); + } + let timestamp = chrono::Utc::now().format("%Y-%m-%d_%H:%M:%S").to_string(); let file = File::create(format!("snapshots/snapshot-{}.csv", timestamp)).unwrap(); let mut writer = BufWriter::new(file);