From f5a11b41c9f358ea19a7a7971a504a0967555e15 Mon Sep 17 00:00:00 2001 From: Josh Lengel Date: Wed, 27 Mar 2024 00:32:28 +0100 Subject: [PATCH] Fix mtllib file name parsing bug for paths including spaces --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index b67d876..9786dfb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1742,7 +1742,8 @@ where } } Some("mtllib") => { - if let Some(mtllib) = words.next() { + // File name can include spaces so we cannot rely on a SplitWhitespace iterator + if let Some(mtllib) = line.split_once(' ').unwrap_or_default().1.trim() { let mat_file = Path::new(mtllib).to_path_buf(); match material_loader(mat_file.as_path()) { Ok((mut mats, map)) => {