diff --git a/implementations/Crafter.Build-External.cpp b/implementations/Crafter.Build-External.cpp index d9dbba5..dbb0e6c 100644 --- a/implementations/Crafter.Build-External.cpp +++ b/implementations/Crafter.Build-External.cpp @@ -37,6 +37,18 @@ std::string DeriveName(const GitSource& source) { } std::string ShellQuote(std::string_view s) { + // Windows cmd treats single quotes as literal characters — only double + // quotes work. Paths don't contain " in practice, so a simple wrap + // suffices; backslashes inside the path stay backslashes. +#ifdef _WIN32 + std::string out = "\""; + for (char c : s) { + if (c == '"') out += "\\\""; + else out += c; + } + out += "\""; + return out; +#else std::string out = "'"; for (char c : s) { if (c == '\'') out += "'\\''"; @@ -44,6 +56,7 @@ std::string ShellQuote(std::string_view s) { } out += "'"; return out; +#endif } std::string JoinOptions(std::span options) {