fix(cli): don't init datadir if it doesn't exist in db command (#9264)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
yutianwu
2024-07-04 16:16:20 +08:00
committed by GitHub
parent 9f55a6a702
commit f0c97cab74

View File

@ -67,6 +67,16 @@ impl Command {
let db_path = data_dir.db();
let static_files_path = data_dir.static_files();
// ensure the provided datadir exist
eyre::ensure!(
data_dir.data_dir().is_dir(),
"Datadir does not exist: {:?}",
data_dir.data_dir()
);
// ensure the provided database exist
eyre::ensure!(db_path.is_dir(), "Database does not exist: {:?}", db_path);
match self.command {
// TODO: We'll need to add this on the DB trait.
Subcommands::Stats(command) => {