polymorphic-agent / src /ui /modifier.rs
diamond-in's picture
Update src/ui/modifier.rs
9f12f4b verified
raw
history blame contribute delete
316 Bytes
use std::fs;
use std::path::Path;
pub fn write_dynamic_component(name: &str, code: &str) -> std::io::Result<()> {
let dir = Path::new("./frontend/src/dynamic");
if !dir.exists() {
fs::create_dir_all(dir)?;
}
let file_path = dir.join(format!("{}.tsx", name));
fs::write(file_path, code)
}