cw-warp 0.4.0

Scaffold, build, test, and deploy CosmWasm Smart Contracts faster than ever before
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::path::Path;

use crate::error::WarpError;

pub fn replace_in_file<P>(path: P, find: &str, replace: &str) -> Result<(), WarpError>
where
    P: AsRef<Path>,
{
    let mut content = std::fs::read_to_string(&path)?;
    content = content.replace(find, replace);
    std::fs::write(&path, content)?;

    Ok(())
}