Avoid creating a default empty database in the infos crate

This commit is contained in:
Clément Renault 2021-02-17 16:19:27 +01:00
parent 794fce7bff
commit 45330a5e47
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -200,6 +200,11 @@ fn run(opt: Opt) -> anyhow::Result<()> {
let mut options = EnvOpenOptions::new();
options.map_size(opt.database_size.get_bytes() as usize);
// Return an error if the database does not exist.
if !opt.database.exists() {
anyhow::bail!("The database ({}) does not exist.", opt.database.display());
}
// Open the LMDB database.
let index = Index::new(options, opt.database)?;
let rtxn = index.read_txn()?;