Mercurial > projects > ldc
changeset 1473:8309ebaa23d5
Fix for finding ldc.conf file with mingw
author | Kelly Wilson <wilsonk cpsc.ucalgary.ca> |
---|---|
date | Thu, 04 Jun 2009 16:04:26 -0600 |
parents | 230765fc82f4 |
children | 39f4b01e2008 |
files | gen/configfile.cpp |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/configfile.cpp Wed Jun 03 16:09:48 2009 +0200 +++ b/gen/configfile.cpp Thu Jun 04 16:04:26 2009 -0600 @@ -11,6 +11,11 @@ #include "mars.h" +#if _WIN32 +#include <windows.h> +#undef GetCurrentDirectory +#endif + namespace sys = llvm::sys; ConfigFile::ConfigFile() @@ -50,12 +55,18 @@ if (!p.exists()) { + #if _WIN32 + char buf[256]; + GetModuleFileName(NULL, buf, 256); + p = *(new std::string(buf)); + #else // 4) try next to the executable p = sys::Path::GetMainExecutable(argv0, mainAddr); + #endif p.eraseComponent(); p.appendComponent(filename); if (!p.exists()) - { + { // 5) fail load cfg, users still have the DFLAGS environment var std::cerr << "Error failed to locate the configuration file: " << filename << std::endl; return false;