Skip to content

Commit

Permalink
qt-build-utils: do not split include paths by space
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ahayzen-kdab committed Oct 10, 2024
1 parent 43f0013 commit e6ee353
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/qt-build-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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())
Expand Down

0 comments on commit e6ee353

Please sign in to comment.