Parcourir la source

faucet/src/main -> update db_path with std::path

Sombra il y a 3 ans
Parent
commit
8da4b7ecb3
1 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 7 2
      bin/faucetd/src/main.rs

+ 7 - 2
bin/faucetd/src/main.rs

@@ -16,7 +16,11 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
-use std::{collections::HashMap, path::PathBuf, str::FromStr};
+use std::{
+    collections::HashMap,
+    path::{Path, PathBuf},
+    str::FromStr,
+};
 
 use async_std::{
     stream::StreamExt,
@@ -549,7 +553,8 @@ async fn realmain(args: Args, ex: Arc<smol::Executor<'_>>) -> Result<()> {
 
     // Initialize or open sled database
     // TODO: Use proper OsPath here, not {}/{}
-    let db_path = format!("{}/{}", expand_path(&args.database)?.to_str().unwrap(), args.chain);
+    let db_path =
+        Path::new(expand_path(&args.database)?.to_str().unwrap()).join(args.chain.clone());
     let sled_db = sled::open(&db_path)?;
 
     // Initialize validator state