Skip to content

Commit

Permalink
Add fs-err
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrodimarco-dfinity committed Nov 15, 2024
1 parent 8acddf7 commit 10e093b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rs/ic-management-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dirs = { workspace = true }
dotenv = { workspace = true }
env_logger = { workspace = true }
fs2 = { workspace = true }
fs-err = { workspace = true }
futures = { workspace = true }
futures-util = { workspace = true }
octocrab = { workspace = true }
Expand Down
6 changes: 1 addition & 5 deletions rs/ic-management-backend/src/public_dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::registry::local_cache_path;
use ic_management_types::Network;
use serde::de::DeserializeOwned;
use std::path::PathBuf;
use tokio::fs;
use fs_err::File;
use tokio::io::{AsyncReadExt, BufReader};
use tokio::{fs::File, io::AsyncWriteExt};

Expand Down Expand Up @@ -38,10 +38,6 @@ pub async fn query_ic_dashboard_list<T: DeserializeOwned>(network: &Network, que
};
match serde_json::from_slice(data.as_slice()) {
Ok(result) => {
if let Some(parent_dir) = std::path::Path::new(&local_cache_file_path).parent() {
fs::create_dir_all(parent_dir).await?;
}

let mut file = File::create(&local_cache_file_path).await?;
file.write_all(&data).await?;
Ok(result)
Expand Down

0 comments on commit 10e093b

Please sign in to comment.