Skip to content

Commit

Permalink
fix(cli): don't init datadir if it doesn't exist in db command
Browse files Browse the repository at this point in the history
  • Loading branch information
yutianwu committed Jul 3, 2024
1 parent b5d61d8 commit 100d752
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/cli/commands/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ impl EnvironmentArgs {
let db_path = data_dir.db();
let sf_path = data_dir.static_files();

if access.is_read_write() {
reth_fs_util::create_dir_all(&db_path)?;
reth_fs_util::create_dir_all(&sf_path)?;
// ensure the provided datadir exist
if !db_path.is_dir() {
return Err(eyre::eyre!("Database path does not exist: {:?}", db_path));
}
if !sf_path.is_dir() {
return Err(eyre::eyre!("Static files path does not exist: {:?}", sf_path));
}

let config_path = self.config.clone().unwrap_or_else(|| data_dir.config());
Expand Down

0 comments on commit 100d752

Please sign in to comment.