瀏覽代碼

script/research/gg: create transactions folder if it doesn't exists

skoupidi 9 月之前
父節點
當前提交
9fa8610650
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      script/research/gg/src/main.rs

+ 4 - 1
script/research/gg/src/main.rs

@@ -17,7 +17,7 @@
  */
 
 use std::{
-    fs::{read_dir, read_to_string},
+    fs::{create_dir, read_dir, read_to_string},
     io::{stdin, Cursor, Read},
     process::exit,
     str::FromStr,
@@ -145,6 +145,9 @@ fn main() -> Result<()> {
 
                 // Grab genesis transactions from folder
                 let txs_folder = expand_path(&txs_folder).unwrap();
+                if !txs_folder.exists() {
+                    create_dir(&txs_folder)?;
+                }
                 let mut tree = MerkleTree::new(1);
                 for file in read_dir(txs_folder)? {
                     let file = file?;