Skip to content

Commit dc6544f

Browse files
committed
Fix line endings on Windows
1 parent 66368ee commit dc6544f

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

build.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ impl PythonBindGenerator {
4848

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

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

53+
#[cfg(windows)]
54+
let contents = contents.replace("\r\n", "\n");
55+
5456
let Some((types, bind_type)) = Self::get_normal_struct_types(&contents, &struct_t_name)
5557
.or_else(|| Self::get_enum_struct_types(&contents, &struct_name))
5658
else {
@@ -1194,10 +1196,9 @@ fn main() -> io::Result<()> {
11941196
.spawn()?
11951197
.wait()?;
11961198

1197-
let out_folder_path = format!("{OUT_FOLDER}/rlbot/flat");
1198-
let out_folder = Path::new(&out_folder_path);
1199+
let out_folder = Path::new(OUT_FOLDER).join("rlbot").join("flat");
11991200

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

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

12121213
for path in generated_files {
1213-
// check if it's a file or a directory
1214-
if path.is_dir() {
1215-
println!("Got directory, skipping for now");
1216-
continue;
1217-
}
1218-
12191214
let Some(mut python_bind_generator) = PythonBindGenerator::new(&path) else {
12201215
continue;
12211216
};

0 commit comments

Comments
 (0)