Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from 0xPolygonZero/output_dir_err_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Jan 21, 2024
2 parents efaf274 + 0305b0f commit 1af2870
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions leader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ async fn main() -> Result<()> {
}
Command::Http { port, output_dir } => {
// check if output_dir exists, is a directory, and is writable
let output_dir_metadata = std::fs::metadata(&output_dir)?;
if !output_dir.is_dir() || output_dir_metadata.permissions().readonly() {
let output_dir_metadata = std::fs::metadata(&output_dir);
if output_dir_metadata.is_err() {
// Create output directory
std::fs::create_dir(&output_dir)?;
} else if !output_dir.is_dir() || output_dir_metadata?.permissions().readonly() {
panic!("output-dir is not a writable directory");
}

Expand Down

0 comments on commit 1af2870

Please sign in to comment.