From 5ae008dc020177551f657707a39f0dcf46c1d318 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Tue, 18 May 2021 16:29:27 +0200
Subject: [PATCH] fix(indexer): create blocks_chunks folder if is not exist

---
 indexer/src/blocks_chunks.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/indexer/src/blocks_chunks.rs b/indexer/src/blocks_chunks.rs
index b5155fe..15a346f 100644
--- a/indexer/src/blocks_chunks.rs
+++ b/indexer/src/blocks_chunks.rs
@@ -83,6 +83,9 @@ fn write_and_compress_chunk_in_file(
     chunks_folder_path: &Path,
 ) -> Result<(), std::io::Error> {
     log::info!("blocks_chunk_{}: {} bytes", chunk_index, chunk.len());
+    if !chunks_folder_path.exists() {
+        std::fs::create_dir(chunks_folder_path)?;
+    }
     let file = std::fs::File::create(chunks_folder_path.join(format!("_{}", chunk_index)))?;
     let mut e = ZlibEncoder::new(file, Compression::new(3));
     e.write_all(chunk)?;
-- 
GitLab