Port GetMainExecutable over to PathV2.
[oota-llvm.git] / lib / Support / Windows / PathV2.inc
index 0c12bb440e8277842cac569b5bba8ff1a3863c73..6987e5fc9daccdd37dc7c09ddc8ab821aa979c12 100644 (file)
@@ -128,6 +128,13 @@ namespace llvm {
 namespace sys  {
 namespace fs {
 
+std::string getMainExecutable(const char *argv0, void *MainExecAddr) {
+  char pathname[MAX_PATH];
+  DWORD ret = ::GetModuleFileNameA(NULL, pathname, MAX_PATH);
+  return ret != MAX_PATH ? pathname : "";
+}
+
+
 TimeValue file_status::getLastModificationTime() const {
   ULARGE_INTEGER UI;
   UI.LowPart = LastWriteTimeLow;