Skip to content

Commit e2d5950

Browse files
committed
0.24.0: the apk-consumer fixture copies its generated file with cmd.exe on a Windows host
Its generator action was gen.sh, a shell script a Windows host cannot start as an action's program; there the same copy is cmd.exe's copy.
1 parent c0ce614 commit e2d5950

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎tests/apk-consumer/build.mcpp‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@ int main() {
3535
mcpp::action a;
3636
a.id = "gen-res";
3737
a.role = "source";
38-
a.arg((root + "/gen.sh").c_str()).arg(src.c_str()).arg(out.c_str())
39-
.input(src.c_str())
38+
// `gen.sh` is a copy, and a Windows host cannot start a shell script as
39+
// an action's program, so there the same copy is cmd.exe's, given native
40+
// paths (`copy` reads a `/` as a switch).
41+
if (std::string_view(mcpp::host()).find("windows") != std::string_view::npos) {
42+
const auto native = [](const std::string& p) {
43+
return std::filesystem::path(p).make_preferred().string();
44+
};
45+
a.arg("cmd").arg("/c").arg("copy").arg("/y")
46+
.arg(native(src).c_str()).arg(native(out).c_str());
47+
} else {
48+
a.arg((root + "/gen.sh").c_str()).arg(src.c_str()).arg(out.c_str());
49+
}
50+
a.input(src.c_str())
4051
.output(out.c_str())
4152
.submit();
4253

0 commit comments

Comments
 (0)