| 399 | | if (compiler == "dmd") { |
|---|
| 400 | | // we have this built in |
|---|
| 401 | | char *inif; |
|---|
| 402 | | |
|---|
| 403 | | if (masterConfig[""].find("inifile") != masterConfig[""].end()) |
|---|
| 404 | | inif = mem.strdup(masterConfig[""]["inifile"].c_str()); |
|---|
| 405 | | else |
|---|
| 406 | | inif = mem.strdup("sc.ini"); |
|---|
| 407 | | |
|---|
| 408 | | // trick whereami into giving us a path |
|---|
| 409 | | char *dir, *fil, *full; |
|---|
| 410 | | if (!whereAmI("dmd", &dir, &fil)) { |
|---|
| 411 | | error("dmd is not in $PATH"); |
|---|
| 412 | | exit(1); |
|---|
| 413 | | } |
|---|
| 414 | | full = (char *) mem.malloc(strlen(dir) + 5); |
|---|
| 415 | | sprintf(full, "%s%cdmd", dir, |
|---|
| 416 | | #if __WIN32 |
|---|
| 417 | | '\\' |
|---|
| 418 | | #else |
|---|
| 419 | | '/' |
|---|
| 420 | | #endif |
|---|
| 421 | | ); |
|---|
| 422 | | inifile(full, inif); |
|---|
| 423 | | mem.free(full); |
|---|
| 424 | | |
|---|
| 425 | | mem.free(inif); |
|---|
| 426 | | |
|---|
| 427 | | } else if (compiler.substr(compiler.length() - 3) == "gdc") { |
|---|
| | 399 | if (compiler.substr(compiler.length() - 3) == "gdc") { |
|---|
| | 440 | } |
|---|
| | 441 | // assume dmd based compiler if inifile is set |
|---|
| | 442 | else if (masterConfig[""].find("inifile") != masterConfig[""].end()) { |
|---|
| | 443 | std::string inif = masterConfig[""]["inifile"]; |
|---|
| | 444 | |
|---|
| | 445 | // trick whereami into giving us a path |
|---|
| | 446 | char *dir, *fil; |
|---|
| | 447 | if (!whereAmI(compiler.c_str(), &dir, &fil)) { |
|---|
| | 448 | error("%s is not in $PATH", compiler.c_str()); |
|---|
| | 449 | exit(1); |
|---|
| | 450 | } |
|---|
| | 451 | std::string full = dir; |
|---|
| | 452 | #if __WIN32 |
|---|
| | 453 | full.append("\\"); |
|---|
| | 454 | #else |
|---|
| | 455 | full.append("/"); |
|---|
| | 456 | #endif |
|---|
| | 457 | full.append(compiler); |
|---|
| | 458 | |
|---|
| | 459 | inifile((char*)full.c_str(), (char*)inif.c_str()); |
|---|