mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-26 08:33:14 +01:00
Improve error message if gcc or other tools can not be found.
This fixes #192.
This commit is contained in:
@@ -84,7 +84,7 @@ static int ExecuteToolAndWait(llvm::sys::Path tool, std::vector<std::string> arg
|
||||
std::string errstr;
|
||||
if (int status = llvm::sys::Program::ExecuteAndWait(tool, &realargs[0], NULL, NULL, 0, 0, &errstr))
|
||||
{
|
||||
error("tool failed:\nstatus: %d", status);
|
||||
error("%s failed with status: %d", tool.c_str(), status);
|
||||
if (!errstr.empty())
|
||||
error("message: %s", errstr.c_str());
|
||||
return status;
|
||||
|
||||
@@ -30,24 +30,21 @@ static cl::opt<std::string> mslib("ms-lib",
|
||||
|
||||
sys::Path getProgram(const char *name, const cl::opt<std::string> &opt, const char *envVar = 0)
|
||||
{
|
||||
sys::Path path;
|
||||
const char *prog = NULL;
|
||||
|
||||
if (opt.getNumOccurrences() > 0 && opt.length() > 0)
|
||||
prog = gcc.c_str();
|
||||
if (opt.getNumOccurrences() > 0 && opt.length() > 0 && (prog = opt.c_str()))
|
||||
path = sys::Program::FindProgramByName(prog);
|
||||
|
||||
if (!prog && envVar)
|
||||
prog = getenv(envVar);
|
||||
if (!prog)
|
||||
prog = name;
|
||||
if (path.empty() && envVar && (prog = getenv(envVar)))
|
||||
path = sys::Program::FindProgramByName(prog);
|
||||
|
||||
sys::Path path = sys::Program::FindProgramByName(prog);
|
||||
if (path.empty() && !prog) {
|
||||
if (prog) {
|
||||
path.set(prog);
|
||||
} else {
|
||||
error("failed to locate %s", name);
|
||||
fatal();
|
||||
}
|
||||
if (path.empty())
|
||||
path = sys::Program::FindProgramByName(name);
|
||||
|
||||
if (path.empty()) {
|
||||
error("failed to locate %s", name);
|
||||
fatal();
|
||||
}
|
||||
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user