| 84 | #include <string> |
| 85 | |
| 86 | static std::wstring GetExeDirectory() |
| 87 | { |
| 88 | wchar_t path[MAX_PATH]; |
| 89 | |
| 90 | DWORD len = GetModuleFileNameW(nullptr, path, MAX_PATH); |
| 91 | if (len == 0 || len == MAX_PATH) |
| 92 | { |
| 93 | return L""; |
| 94 | } |
| 95 | |
| 96 | // Strip filename |
| 97 | for (DWORD i = len; i > 0; --i) |
| 98 | { |
| 99 | if (path[i - 1] == L'\\' || path[i - 1] == L'/') |
| 100 | { |
| 101 | path[i - 1] = L'\0'; |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | return std::wstring(path); |
| 107 | } |
| 108 | |
| 109 | static bool FileExists(const std::wstring& path) |
| 110 | { |