update code
This commit is contained in:
@@ -18,6 +18,11 @@ pub(crate) fn write_file(path: &str, content: Bytes) -> Result<(), std::io::Erro
|
||||
}
|
||||
|
||||
pub(crate) fn read_file_string(path: &str) -> Result<String, std::io::Error> {
|
||||
let path = Path::new(path);
|
||||
let folder_path = path.parent();
|
||||
if !folder_path.unwrap().exists() {
|
||||
fs::create_dir_all(folder_path.unwrap().as_os_str())?;
|
||||
}
|
||||
let mut file = File::open(path)?;
|
||||
let mut contents = String::new();
|
||||
file.read_to_string(&mut contents)?;
|
||||
|
||||
Reference in New Issue
Block a user