Skip to content

Commit e6ee353

Browse files
committed
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
1 parent 43f0013 commit e6ee353

File tree

1 file changed

+3
-3
lines changed
  • crates/qt-build-utils/src

1 file changed

+3
-3
lines changed

crates/qt-build-utils/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,14 @@ impl QtBuild {
618618

619619
let metatypes_json_path = PathBuf::from(&format!("{}.json", output_path.display()));
620620

621-
let mut include_args = String::new();
621+
let mut include_args = vec![];
622622
// Qt includes
623623
for include_path in self
624624
.include_paths()
625625
.iter()
626626
.chain(arguments.include_paths.iter())
627627
{
628-
include_args += &format!("-I {} ", include_path.display());
628+
include_args.push(format!("-I{}", include_path.display()));
629629
}
630630

631631
let mut cmd = Command::new(self.moc_executable.as_ref().unwrap());
@@ -634,7 +634,7 @@ impl QtBuild {
634634
cmd.arg(format!("-Muri={uri}"));
635635
}
636636

637-
cmd.args(include_args.trim_end().split(' '));
637+
cmd.args(include_args);
638638
cmd.arg(input_path.to_str().unwrap())
639639
.arg("-o")
640640
.arg(output_path.to_str().unwrap())

0 commit comments

Comments
 (0)