Skip to content

Commit

Permalink
Use AsRef<str>
Browse files Browse the repository at this point in the history
Signed-off-by: Franco Cipollone <[email protected]>
  • Loading branch information
francocipollone committed Nov 13, 2024
1 parent 93f3166 commit fedacd9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions maliput/src/utility/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ pub type ObjFeatures = maliput_sys::utility::ffi::Features;
pub fn generate_obj_file(
road_network: &RoadNetwork,
dirpath: impl AsRef<Path>,
fileroot: &String,
fileroot: impl AsRef<str>,
obj_features: &ObjFeatures,
) -> Result<PathBuf, Box<dyn Error>> {
// Saves the complete path to the generated Wavefront file.
let future_obj_file_path = dirpath.as_ref().join(fileroot.clone() + ".obj");
let future_obj_file_path = dirpath.as_ref().join(fileroot.as_ref().to_string() + ".obj");
let dirpath = to_string(dirpath)?;
// Creates dirpath if does not exist.
if !Path::new(&dirpath).exists() {
Expand All @@ -66,7 +66,12 @@ pub fn generate_obj_file(
let raw_rn = road_network.rn.as_ref();
if let Some(raw_rn) = raw_rn {
unsafe {
maliput_sys::utility::ffi::Utility_GenerateObjFile(raw_rn, &dirpath, fileroot, obj_features);
maliput_sys::utility::ffi::Utility_GenerateObjFile(
raw_rn,
&dirpath,
&fileroot.as_ref().to_string(),
obj_features,
);
}
// Verify if the file was created.
if future_obj_file_path.is_file() && future_obj_file_path.with_extension("mtl").is_file() {
Expand Down

0 comments on commit fedacd9

Please sign in to comment.