Fixed Windows version of getExecutablePath().

This commit is contained in:
Patrick 2025-01-22 11:54:13 +01:00
parent 6d2a57485e
commit 55fb360dfa

View File

@ -2,6 +2,7 @@
#include "os.hpp"
#include <filesystem>
#include "../debug/assert.hpp"
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
#include <mutex>
@ -106,7 +107,7 @@ std::string getExecutablePath() MIJIN_NOEXCEPT
#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS
// TODO: this is completely untested
std::array<char, 1024> buffer;
if (FAILED(GetModuleFileNameA(nullptr, buffer.data(), buffer.size())))
if (FAILED(GetModuleFileNameA(nullptr, buffer.data(), static_cast<DWORD>(buffer.size()))))
{
std::vector<char> buffer2;
buffer2.resize(1024);
@ -119,7 +120,7 @@ std::string getExecutablePath() MIJIN_NOEXCEPT
}
buffer2.resize(buffer2.size() + 1024);
}
while (FAILED(GetModuleFileNameA(nullptr, buffer.data(), buffer.size())));
while (FAILED(GetModuleFileNameA(nullptr, buffer.data(), static_cast<DWORD>(buffer.size()))));
return buffer2.data();
}
return buffer.data();