diff --git a/src/db.rs b/src/db.rs
index c3fe596..1500ec2 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -782,17 +782,7 @@ impl DB {
{
let cfs: Vec<_> = cfs.into_iter().collect();
- let path = path.as_ref();
- let cpath = match CString::new(path.to_string_lossy().as_bytes()) {
- Ok(c) => c,
- Err(_) => {
- return Err(Error::new(
- "Failed to convert path to CString \
- when opening DB."
- .to_owned(),
- ));
- }
- };
+ let cpath = to_cpath(&path)?;
if let Err(e) = fs::create_dir_all(&path) {
return Err(Error::new(format!(
@@ -848,9 +838,7 @@ impl DB {
for handle in &cfhandles {
if handle.is_null() {
return Err(Error::new(
- "Received null column family \
- handle from DB."
- .to_owned(),
+ "Received null column family handle from DB.".to_owned(),
));
}
}
@@ -867,7 +855,7 @@ impl DB {
Ok(DB {
inner: db,
cfs: cf_map,
- path: path.to_path_buf(),
+ path: path.as_ref().to_path_buf(),
})
}
@@ -1007,11 +995,8 @@ impl DB {
) -> Result