mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
[Windows] Add diagnostics about missing ComSpec environment variable while setting up an MSVC environment during linking. If ComSpec is not defined, assume "cmd.exe".
This commit is contained in:
parent
8e2f993117
commit
54e9a69b29
1 changed files with 7 additions and 2 deletions
|
@ -358,11 +358,16 @@ int executeMsvcToolAndWait(const std::string &tool,
|
|||
* be parsed properly.
|
||||
*/
|
||||
|
||||
std::string cmdPath = getenv("ComSpec");
|
||||
auto comspecEnv = getenv("ComSpec");
|
||||
if (!comspecEnv) {
|
||||
warning(Loc(), "'ComSpec' environment variable is not set, assuming 'cmd.exe'.");
|
||||
comspecEnv = "cmd.exe";
|
||||
}
|
||||
std::string cmdExecutable = comspecEnv;
|
||||
std::string batchFile = exe_path::prependBinDir(
|
||||
global.params.targetTriple.isArch64Bit() ? "amd64.bat" : "x86.bat");
|
||||
|
||||
commandLine.append(windows::quoteArg(cmdPath));
|
||||
commandLine.append(windows::quoteArg(cmdExecutable));
|
||||
commandLine.append(" /s /c \"");
|
||||
commandLine.append(windows::quoteArg(batchFile));
|
||||
commandLine.push_back(' ');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue