Mercurial > lbo > hg > leveldb-rs
changeset 495:8b8d885da925
db_impl: Use absolute paths when referring to the database
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 06 Oct 2019 11:16:55 +0200 |
parents | 02c21c7063f3 |
children | 6ee8f9d6116e |
files | src/db_impl.rs |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/db_impl.rs Sun Oct 06 11:16:40 2019 +0200 +++ b/src/db_impl.rs Sun Oct 06 11:16:55 2019 +0200 @@ -41,6 +41,7 @@ /// is not concurrent (yet). pub struct DB { name: PathBuf, + path: PathBuf, lock: Option<FileLock>, internal_cmp: Rc<Box<dyn Cmp>>, @@ -69,12 +70,14 @@ let log = open_info_log(opt.env.as_ref().as_ref(), name); opt.log = Some(share(log)); } + let path = name.canonicalize().unwrap_or(name.to_owned()); let cache = share(TableCache::new(&name, opt.clone(), opt.max_open_files - 10)); let vset = VersionSet::new(&name, opt.clone(), cache.clone()); DB { name: name.to_owned(), + path: path, lock: None, internal_cmp: Rc::new(Box::new(InternalKeyCmp(opt.cmp.clone()))), fpol: InternalFilterPolicy::new(opt.filter_policy.clone()),