radix-clis 1.4.0

A collection of CLIs for developing, building and testing Scrypto code, from the Radix DLT project.
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::prelude::*;

pub fn write_ensuring_folder_exists(
    file_path: impl AsRef<Path>,
    contents: impl AsRef<[u8]>,
) -> Result<(), std::io::Error> {
    let file_path = file_path.as_ref();
    if let Some(parent_folder) = file_path.parent() {
        fs::create_dir_all(parent_folder)?;
    }
    fs::write(file_path, contents)?;
    Ok(())
}