# HG changeset patch # User Kelly Wilson # Date 1244153195 21600 # Node ID 39f4b01e200831ef555a451c9951cc1ae1d31f8e # Parent 8309ebaa23d585779261c400bab2fbba9cc4c9fe# Parent a28953f1eb435abd57cd146cd0f3a260890f4715 merging diff -r a28953f1eb43 -r 39f4b01e2008 gen/configfile.cpp --- a/gen/configfile.cpp Thu Jun 04 15:59:51 2009 +0200 +++ b/gen/configfile.cpp Thu Jun 04 16:06:35 2009 -0600 @@ -11,6 +11,11 @@ #include "mars.h" +#if _WIN32 +#include +#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;