Spaces:
Build error
Build error
Update src/ui/modifier.rs
Browse files- src/ui/modifier.rs +8 -3
src/ui/modifier.rs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
| 1 |
use std::fs;
|
|
|
|
| 2 |
|
| 3 |
-
pub fn
|
| 4 |
-
let
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
}
|
|
|
|
| 1 |
use std::fs;
|
| 2 |
+
use std::path::Path;
|
| 3 |
|
| 4 |
+
pub fn write_dynamic_component(name: &str, code: &str) -> std::io::Result<()> {
|
| 5 |
+
let dir = Path::new("./frontend/src/dynamic");
|
| 6 |
+
if !dir.exists() {
|
| 7 |
+
fs::create_dir_all(dir)?;
|
| 8 |
+
}
|
| 9 |
+
let file_path = dir.join(format!("{}.tsx", name));
|
| 10 |
+
fs::write(file_path, code)
|
| 11 |
}
|