Skip to content

Commit

Permalink
Fix line endings on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Jan 28, 2024
1 parent 66368ee commit dc6544f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ impl PythonBindGenerator {

let struct_t_name = format!("{struct_name}T");

// read the contents of the file
let contents = fs::read_to_string(path).ok()?;

#[cfg(windows)]
let contents = contents.replace("\r\n", "\n");

let Some((types, bind_type)) = Self::get_normal_struct_types(&contents, &struct_t_name)
.or_else(|| Self::get_enum_struct_types(&contents, &struct_name))
else {
Expand Down Expand Up @@ -1194,10 +1196,9 @@ fn main() -> io::Result<()> {
.spawn()?
.wait()?;

let out_folder_path = format!("{OUT_FOLDER}/rlbot/flat");
let out_folder = Path::new(&out_folder_path);
let out_folder = Path::new(OUT_FOLDER).join("rlbot").join("flat");

assert!(out_folder.exists(), "Could not find generated folder: {}", out_folder_path);
assert!(out_folder.exists(), "Could not find generated folder: {}", out_folder.display());

// ^ the above generates the Rust flatbuffers code,
// and the below we generates the wanted additional Python binds
Expand All @@ -1210,12 +1211,6 @@ fn main() -> io::Result<()> {
let mut type_data = Vec::new();

for path in generated_files {
// check if it's a file or a directory
if path.is_dir() {
println!("Got directory, skipping for now");
continue;
}

let Some(mut python_bind_generator) = PythonBindGenerator::new(&path) else {
continue;
};
Expand Down

0 comments on commit dc6544f

Please sign in to comment.