Last cleanup
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
use std::{fs::{self, File}, io::Write, process::Command};
|
||||
use std::{fs::{exists, read_dir, remove_dir_all, File}, io::Write, process::Command};
|
||||
|
||||
|
||||
fn main() {
|
||||
|
||||
if exists("src/models").unwrap() {
|
||||
remove_dir_all("src/models").unwrap();
|
||||
}
|
||||
|
||||
let _ =
|
||||
Command::new("openapi-generator")
|
||||
.args(["generate", "-i", "gamenight-api.yaml", "-g", "rust", "--global-property", "models"])
|
||||
@@ -9,7 +14,7 @@ fn main() {
|
||||
.expect("Failed to generate models sources for the gamenight API");
|
||||
|
||||
let mut file = File::create("src/models/mod.rs").unwrap();
|
||||
let paths = fs::read_dir("./src/models").unwrap();
|
||||
let paths = read_dir("./src/models").unwrap();
|
||||
for path in paths {
|
||||
let path = path.unwrap();
|
||||
let path = path.path();
|
||||
@@ -19,6 +24,6 @@ fn main() {
|
||||
}
|
||||
|
||||
let line = format!("pub mod {};\n", stem.to_str().unwrap());
|
||||
file.write(line.as_bytes()).unwrap();
|
||||
let _ = file.write(line.as_bytes()).unwrap();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user