From e6ee353754259e4a289fcb8236fa4d63b63ccdaf Mon Sep 17 00:00:00 2001 From: Andrew Hayzen Date: Thu, 10 Oct 2024 11:20:30 +0100 Subject: [PATCH] qt-build-utils: do not split include paths by space Before a string such as "-I /path to Qt/ -I /another/path/" would be created and then split by space. This works when there are no spaces in the string but in the example here it becomes `["-I", "/path", "to", "Qt/", "-I", "/another/path/"]`. Instead we actually want ["-I", "/path to Qt/", "-I", "/another/path/"] or we can combine the -I and have ["-I/path to Qt/", "-I/another/path/"]. So instead build a vector of include args to give to Command args instead of splitting the string. Which then resolves having a space in your Qt or library path. Closes #756 --- crates/qt-build-utils/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/qt-build-utils/src/lib.rs b/crates/qt-build-utils/src/lib.rs index ffd6780b8..b3e095442 100644 --- a/crates/qt-build-utils/src/lib.rs +++ b/crates/qt-build-utils/src/lib.rs @@ -618,14 +618,14 @@ impl QtBuild { let metatypes_json_path = PathBuf::from(&format!("{}.json", output_path.display())); - let mut include_args = String::new(); + let mut include_args = vec![]; // Qt includes for include_path in self .include_paths() .iter() .chain(arguments.include_paths.iter()) { - include_args += &format!("-I {} ", include_path.display()); + include_args.push(format!("-I{}", include_path.display())); } let mut cmd = Command::new(self.moc_executable.as_ref().unwrap()); @@ -634,7 +634,7 @@ impl QtBuild { cmd.arg(format!("-Muri={uri}")); } - cmd.args(include_args.trim_end().split(' ')); + cmd.args(include_args); cmd.arg(input_path.to_str().unwrap()) .arg("-o") .arg(output_path.to_str().unwrap())