--------------------- GetExecutablePathName Gets the name and path the executable lives in
| 65 | // Gets the name and path the executable lives in |
| 66 | // |
| 67 | void GetExecutablePathName(std::string& outPath) |
| 68 | { |
| 69 | char ownPth[MAX_PATH]; |
| 70 | |
| 71 | // When NULL is passed to GetModuleHandle, the handle of the exe itself is returned |
| 72 | HMODULE hModule = GetModuleHandle(NULL); |
| 73 | ET_ASSERT(hModule != NULL); |
| 74 | |
| 75 | // Use GetModuleFileName() with module handle to get the path |
| 76 | GetModuleFileName(hModule, ownPth, (sizeof(ownPth))); |
| 77 | |
| 78 | outPath = std::string(ownPth); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | } // namespace core |