Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Fix proto generation script #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions proto/generate.ers
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ fn main() {
.collect::<Result<Vec<_>, io::Error>>()
.unwrap();
// Get proto filenames without `.proto` extension
let input_filenames = input_files
let mut input_filenames = input_files
.iter()
.map(|file| file.file_stem().unwrap().to_str().unwrap())
.collect::<Vec<_>>();
input_filenames.sort();
println!("Proto files that will be generated: {:#?}", input_filenames);

// Ask not to generate `mod.rs` file, we will do it ourselves
Expand Down Expand Up @@ -90,6 +91,7 @@ fn main() {
// Concatenate all this shit
let mut mod_file =
String::from("// This file is generated by `../proto/generate.ers`. Do not edit.\n\n");
mod_file.push_str("#![allow(ambiguous_glob_reexports)]\n\n");
for line in module_lines {
mod_file.push_str(line.as_str());
}
Expand All @@ -98,7 +100,7 @@ fn main() {
mod_file.push_str(line.as_str());
}
// Write generated `mod.rs` file
output_dir.push("/mod.rs");
output_dir.push("mod.rs");
fs::write(output_dir, mod_file).unwrap();
println!("✔ - Mod file generated");
}
2 changes: 2 additions & 0 deletions src/messages/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// This file is generated by `../proto/generate.ers`. Do not edit.

#![allow(ambiguous_glob_reexports)]

mod cstrike15_gcmessages;
mod cstrike15_usermessages;
mod engine_gcmessages;
Expand Down