(cmd_args: &ConvertSubcommandArgs)
| 116 | } |
| 117 | |
| 118 | fn convert_mesh(cmd_args: &ConvertSubcommandArgs) -> Result<(), anyhow::Error> { |
| 119 | profile!("mesh file conversion cli"); |
| 120 | |
| 121 | let io_params = io::FormatParameters::default(); |
| 122 | let input_file = cmd_args.input_mesh.as_ref().unwrap(); |
| 123 | let output_file = &cmd_args.output_file; |
| 124 | |
| 125 | // Try to load surface mesh |
| 126 | let mesh: MeshWithData<f32, _> = io::read_surface_mesh(input_file.as_path(), &io_params.input) |
| 127 | .with_context(|| { |
| 128 | format!( |
| 129 | "Failed to load surface mesh from file \"{}\"", |
| 130 | input_file.as_path().display() |
| 131 | ) |
| 132 | })?; |
| 133 | |
| 134 | // Write mesh |
| 135 | io::write_mesh(&mesh, output_file.as_path(), &io_params.output)?; |
| 136 | |
| 137 | Ok(()) |
| 138 | } |
| 139 | |
| 140 | /// Returns an error if the file already exists but overwrite is disabled |
| 141 | fn overwrite_check(cmd_args: &ConvertSubcommandArgs) -> Result<(), anyhow::Error> { |
no test coverage detected